开发者

avoid middle whitespace in UITextField

I am new to Iphone development. I have tried the following code, but it does not work with middle whitespace in UITEXTFIELD.

NSString *t1 = [txt.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];

How ca开发者_开发百科n I avoid middle whitespace?



Use this code may this use full.

NSString *t1=[txt.text stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];


NSString *t1= [txt.text stringByReplacingOccurrencesOfString:@" " withString:@""]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜