mardi 9 août 2016

How to truncate fraction using NSNumberFormatter

How can I format decimal values with next rules

0.123 => 0.12
10.1234 => 10.12
100.12345 => 100.1
1000.12345 => 1,000

C style printf allows to do this using something 4.2%f plus somehow thousands separator but I don't get how to reflect it in Cocoa.

Aucun commentaire:

Enregistrer un commentaire