This question has been answered in objective-c here. How can I do it in Swift?
Asked
Active
Viewed 769 times
-2
-
2How about you post your actual question here? – TimoStaudinger May 31 '15 at 19:24
-
How can i accept them as answers? Some of them are very good – Dmomo May 31 '15 at 19:34
-
You can only accept one answer to your own question as correct. For other questions, you can only upvote a helpful answer by using the arrows next to the answer. – TimoStaudinger May 31 '15 at 19:37
-
Don't see any accept button on the page. Should I click on the answer, then it will show up ? – Dmomo May 31 '15 at 19:47
-
https://www.dropbox.com/s/jwu494cg3r92vcu/file%20may%2031%2C%204%2056%2025%20pm.png?dl=0 – Leo Dabus May 31 '15 at 19:57
-
If you're going to use APIs that were created in C and Objective-C in a language that is still not stably defines you will do better to learn it in those languages as well. – uchuugaka Jun 01 '15 at 00:40
1 Answers
2
import UIKit
let nf = NumberFormatter()
nf.currencySymbol = ""
nf.numberStyle = .currency
let stringForNumber = nf.string(for: 100) // "100.00"

Leo Dabus
- 229,809
- 59
- 489
- 571
-
-
it is being imported already. and Vote Up requires 15 reputation for me. – Dmomo May 31 '15 at 22:08
-
if it is iOS you have to import UIKit. The code above should be fine – Leo Dabus May 31 '15 at 23:42
-