Truncate white space in text in iphone/objective c -
Is there a function to remove white spaces from text messages in Objective C?
For example: For "How are you", the result should be "howareyou"
Thank you in advance.
You can use components of NSString to set the sensor with whitespace SeparateBearactors Set the inserts, first whotspace Split the string on, and then join the component using componentsJoinedByString of NSArray.
For example.
NSString * myString = @ "How are you"; MyString = [[[MyString Components] SeparatorActors Inset: [NSCharacterSet whitespaceCharacterSet]] componentsJoinedByString: @ ""]; NSLog (myString); // display haureau
Comments
Post a Comment