What is the easiest way to format a string like "1234567890123456789" to "1234 5678 9012 3456 789" in iOS?
Try this:
-(NSString *) correctString:(NSString *) anyStr {
NSMutableString *str = [NSMutableString stringWithString:anyStr];
int indx=4;
while (indx<str.length) {
[str insertString:@" " atIndex:indx];
indx +=5;
}
anyStr=str;
return anyStr;
}