Reputation: 2651
What is the shortest way to create a string with spaces and desired length in Objective-C?
I can do it using for
cycle, but it's several lines of code.
Upvotes: 0
Views: 84
Reputation: 24248
Returns first six characters
NSString *fullName = @"Warif Akhand Rishi";
NSString *subString = [fullName substringToIndex:6];
Upvotes: 2
Reputation: 36082
Have you looked at stringWithFormat ?
[NSMutableString stringWithFormat:@"%20d", 42];
Upvotes: 0