Sunday, 15 August 2010

objective c - how to remove the extra spaces in UILabel in IOS -



objective c - how to remove the extra spaces in UILabel in IOS -

i have string coming web service below //coming string below format. user commented unusually.for eg user pressed new lines 3 times,entered text , 1 time again pressed new line , posted comment below

super

how remove new lines, spaces other stuff other text in uilabel.i tried below code not trimmed..

nsstring* result = [mystring stringbytrimmingcharactersinset:[nscharacterset whitespaceandnewlinecharacterset]]; custom.mylabel.text=result; //also tried below code custom.mylabel.text=[mystring stringbyreplacingoccurrencesofstring:@"\n" withstring:@""]; custom.mylabel.text=[mystring stringbyreplacingoccurrencesofstring:@"\t" withstring:@""];

please suggest ideas how prepare it..

thanks in advance..

text = [text stringbytrimmingcharactersinset:[nscharacterset whitespaceandnewlinecharacterset]]

ios objective-c

No comments:

Post a Comment