NSString *myString = @"A B C D E F G";
I want to remove the spaces, and get a string out like "ABCDEFG".
Please help me...
Thanks and regards
NSString *myString = @"A B C D E F G";
I want to remove the spaces, and get a string out like "ABCDEFG".
Please help me...
Thanks and regards
You could use:
NSString *stringWithoutSpaces = [myString stringByReplacingOccurencesOfString:@" " withString:@""];
If you want to support more than one space at a time, or support any whitespace, you can do this:
NSString * noSpaces = [[myString componentsSeparatedByCharactersInSet: [NSCharacterSet whitespaceCharacterSet]] componentsJoinedByString: @""];