In array I do have two values value1="234.3423" value2="12.60348" i need to pass this value to varable double x, double y;
How to do this
Thanks in advance.
In array I do have two values value1="234.3423" value2="12.60348" i need to pass this value to varable double x, double y;
How to do this
Thanks in advance.
First, you need to turn them into the number (which you're giving in C string syntax here) into an NSString:
char *value1 = "234.3423";
NSString *string1 = [NSString stringWithUTF8String:value1];
Then, simply do this:
double x = [string1 doubleValue];
That's it. If the simple number parsing of NSString
is not enough for you, you will need to look into NSScanner
.
double x=[[myArrayList objectAtIndext:1] doubleValue];
double y=[[myArrayList objectAtIndext:2] doubleValue];
Hope its works for me :D
If not help me any another easy way.