I am fairly new to Swift and having a great deal of trouble finding a way to add a space as a thousand separator.
What I am hoping to achieve is taking the result
Try this
func addPoints(inputNumber: NSMutableString){ var count: Int = inputNumber.length while count >= 4 { count = count - 3 inputNumber.insert(" ", at: count) // you also can use "," } print(inputNumber) }
The call:
addPoints(inputNumber: "123456")
The result:
123 456 (or 123,456)