//: Playground - noun: a place where people can play
import UIKit
func convertCurrency( money : NSNumber, style : NSNumberFormatterStyle ) -> String {
let numberFormatter = NSNumberFormatter()
numberFormatter.numberStyle = style
return numberFormatter.stringFromNumber( money )!
}
let value = 12345678.123
convertCurrency(value, style : NSNumberFormatterStyle.DecimalStyle)
convertCurrency(value, style : NSNumberFormatterStyle.NoStyle)
convertCurrency(value, style : NSNumberFormatterStyle.CurrencyStyle)
#=========== Output ===================
12,345,678.123 <-- decimalstyle="" font="">-->
12345678 <-- font="" nostyle="">-->
$12,345,678.12 <-- currencystyle="" font="">-->