NSString stringWithFormat with tabs instead of spaces

You can see that after my line I add 40 spaces, but it starts at index 0. Can I do the same with the "\ t" tab instead of spaces? "?

NSString *firstString = [[NSString stringWithFormat:@"%@",stringToWrite] stringByPaddingToLength:40 withString:@" " startingAtIndex:0]; 
+4
source share
1 answer

Yes @"\t" will put a tab instead of spaces.
Also, your line might be a little simpler:

 NSString *firstString = [stringToWrite stringByPaddingToLength:40 withString:@" " startingAtIndex:0]; 
+8
source

All Articles