I have a string like this in Swift:
var stringts:String = "3022513240"
If I want to change it to string to something like this: "(302)-251-3240"
, I want to add the partheses at index 0, how do I do it?
In Objective-C, it is done this way:
NSMutableString *stringts = "3022513240";
[stringts insertString:@"(" atIndex:0];
How to do it in Swift?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…