Back to Home

Adding Thousand Separator to Int in Swift

Shane Qi • 2016-05-12 15:16

Straight forward:

import Foundation

let fmt = NSNumberFormatter()
fmt.numberStyle = .DecimalStyle
fmt.stringFromNumber(2358000) 
// "2,358,000"