I want to add a string to NSMutableString using appendFormat, inserting spaces to get the minimum length for my string.
In objective-c, I just used
[text.mutableString appendFormat:@"%-12s", "MyString"];
and i get
"MyString "
But in Swift I tried
text.mutableString.appendFormat("%-12s", "MyString")
and I get everything but not "MyString". There seem to be some random characters that I donβt know where they came from.
Is there anyone who knows why this is happening, and what should I do?
Thanks guys!
ios xcode swift nsmutablestring
Marcos kobuchi
source share