[ios]swift comma만드는 방법
숫자를 가격으로 나오게 comma로 만들려면 어떻게 해야 할까??
static func getComma(price : Int) -> String
{
let formatter = NumberFormatter()
formatter.locale = NSLocale.current
formatter.numberStyle = NumberFormatter.Style.decimal
formatter.usesGroupingSeparator = true
return formatter.string(from: price as NSNumber) ?? ""
}
'ios,swift' 카테고리의 다른 글
[ios] uiview child view hide 방법 (0) | 2020.01.30 |
---|---|
[ios] swift scrollview scroll가능하게 (0) | 2020.01.30 |
[ios] swift percent 보여주는 방법 (0) | 2020.01.30 |
[ios] swift already presenting issue 해결방법 (0) | 2020.01.30 |
[ios] swift click이벤트를 막는 방법 (0) | 2020.01.30 |