objective c - NSString to float value incorrect -


i have nsstring converting float value , result logged this

2,146.952 float 2.000000 

the comma seems cause float value rounded down, if use doublevalue] same.

is there way 2146.952?

try,

1) remove comma string

nsstring * str = [str stringbyreplacingoccurencesofstring:@"," withstring:@""]; 

2) retrieve float value string

float f = [str floatvalue]; 

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

c# - Can I intercept a SOAP response in .NET before a content type binding mismatch ProtocolException? -

css - Can I use the :after pseudo-element on an input field? -