How can I calculate the number of digits after the floating point in iOS?
For example:
Update: Also we need to add the following example. As I want to know number of digits in the fraction part.
Try this way:
NSString *enteredValue=@"99.1234";
NSArray *array=[enteredValue componentsSeparatedByString:@"."];
NSLog(@"->Count : %ld",[array[1] length]);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With