Objective-c – Remove characters from NSString

nsstringobjective c

NSString *myString = @"A B C D E F G";

I want to remove the spaces, so the new string would be "ABCDEFG".

Best Answer

You could use:

NSString *stringWithoutSpaces = [myString 
   stringByReplacingOccurrencesOfString:@" " withString:@""];