Convert String to Number in XCode-
Variable declare-
NSNumberFormatter * numValue = [[NSNumberFormatter alloc] init];
Set the number variable to contain Decimal value.
[numValue setNumberStyle:NSNumberFormatterDecimalStyle];
[numValue setNumberStyle:NSNumberFormatterDecimalStyle];
Get the string value from string-
NSNumber * myNumber = [numValue numberFromString:@"7"];
NSNumber * myNumber = [numValue numberFromString:@"7"];
Release memory-
[myNumber release];
[myNumber release];
Convert Number to String in XCode-
NSString *myStr = [NSString stringWithFormat:@"%d",intValueHere];
That’s it Enjoy J
No comments:
Post a Comment