Reputation: 1061
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 can I avoid middle whitespace?
Upvotes: 2
Views: 449
Reputation: 4305
Use this code may this use full.
NSString *t1=[txt.text stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
Upvotes: 6
Reputation: 11914
NSString *t1= [txt.text stringByReplacingOccurrencesOfString:@" " withString:@""]
Upvotes: 1