I would like to find a way to format a NSString like this:
Name: John
Location: Unknown
Type: Unknown
Status: Unknown
Right now I'm using this code to do it but the result is quite different:
The code:
serializedValue = [serializedValue stringByAppendingFormat:@"%@:%@
",title, value];
Where title
is the left column and value
is the second one.
The result:
Name: John
Location: Unknown
Type: Unknown
Status: Unknown
Now, as you can see, adding always a constant number of tabs (), 2 in my case, doesn't do the trick, because some words in the left column are longer and some are shorter. I'm wondering if there is a simple way to do this that I'm not aware of.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…