开发者

avoid middle whitespace in UITextField

开发者 https://www.devze.com 2023-01-31 03:58 出处:网络
I am new to Iphone development. I have tried the following code, but it does not work with 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

精彩评论

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