I have been trying to use NSScanner or even a for loop in a string to remove duplicate NSDecimalSeparator. How to do that?
Note: NSDecimalSeparator is not “just a comma”. It changes according to the iOS current localization. So, any implementation applying a search for duplicate “comma” won’t work.
NSDecimalSeparatoris deprecated. I would recommend usingNSNumberFormatter:Edit:
Regarding your comment about “23,45,67” string, here it is:
Edit 2:
Code to keep only first separator is similar: