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

Capture and play voice with Asterisk ARI -

java - Why database contraints in HSQLDB are only checked during a commit when using transactions in Hibernate? -

visual studio - Installing Packages through Nuget - "Central Directory corrupt" -