In my application, user put two values into 'TextField' but for make calculations between them. i need to have have a '.' (for exemple: 10.65). If the user put a ',' the app fail (for exemple: 10,65). But in French, in the decimal pad you don't have a '.' only a ','. How can i convert the value with ',' (10,65) into '.' (10.65).enter image description here
Asked
Active
Viewed 53 times
0
-
2just replace all `,` to `.` before parsing or parse using `NumberFormatter` with the correct locale set. – Sulthan Jun 24 '17 at 15:23
-
https://stackoverflow.com/questions/30150829/uitextfields-numerical-pad-dot-instead-of-comma-for-float-values/30154625#30154625 – Leo Dabus Jun 24 '17 at 15:27
-
1Note that english speaking people might enter "1,000" for "one thousand", so replacing the comma by a dot is not always correct. – Martin R Jun 24 '17 at 15:30
-
https://stackoverflow.com/a/29783546/2303865 – Leo Dabus Jun 24 '17 at 15:31