I would like to find a way to format NSString as follows:
Name: John Location: Unknown Type: Unknown Status: Unknown
Now I use this code for this, but the result is completely different:
Code:
serializedValue = [serializedValue stringByAppendingFormat:@"%@:\t\t%@\n",title, value];
Where title is the left column and value is the second.
Result:
Name: John Location: Unknown Type: Unknown Status: Unknown
Now, as you can see, adding always a constant number of tabs (\ t), 2 in my case, does not do the trick, because some words in the left column are longer and some are shorter. I am wondering if there is an easy way to do this that I do not know about.
source share