NSString padding / space between characters
ios, kerning, nsstring, objective-c, padding
Solution
Try This :
NSString *string =[NSString stringWithString:@"1234"];
NSMutableArray *buffer = [NSMutableArray arrayWithCapacity:[string length]];
for (int i = 0; i < [string length]; i++) {
[buffer addObject:[NSString stringWithFormat:@"%C", [string characterAtIndex:i]]];
}
NSString *final_string = [buffer componentsJoinedByString:@" "];
Problem
I'm looking for an easy way in Obj.C to do add a space between each character of my string. So "1234" would come out looking like "1 2 3 4". I've found a perfect javascript example here: https://stackoverflow.com/a/7437422/949538 Does anyone know of something similar for Obj.C? Kerning is a PITA in iOS, and this is ultimately all I need anyway... Thoughts / comments? Thanks! - Drew