nicklockwood / FXForms

[DEPRECATED]
Other
2.93k stars 339 forks source link

Support European numerical pad (with comma instead of dot) #468

Open danieldavid opened 7 years ago

danieldavid commented 7 years ago

Hi, When using European numerical pad, decimal point is a comma (and not the dot we all know and use). So when entering a number to a cell of numeric/float type , the "setValue" function inside FXForms.m convert it to double and basically remove the dot and practically convert it to int. To handle it, the "double value" need to be replaced with NSNumber formatter.

This is the problematic line of code: value = [(NSString *)value length]? @([value doubleValue]): nil;

These are the lines that can be used to replace the above: NSNumberFormatter nf = [NSNumberFormatter new]; value = [(NSString )value length] ? @([[nf numberFromString:value] doubleValue]) : nil;

The result is a numeric number (with a dot instead of comma).

Thanks