Objective-Cで数値から文字列への変換、文字列から数値への変換

ppc2011-05-08

http://d.hatena.ne.jp/ugon105/20100905/1283708178
このサイトはとてもよい。
以下、このサイトから抜粋;

文字列から数値へ
NSString *str = @"1.23456789";
int x = [str intValue];
float y = [str floatValue];
double z = [str doubleValue];

整数を文字列へ
int x = 100;
NSString *str = [NSString stringWithFormat:@"%d", x];


実数を文字列へ
float x = 1.2345f;
double y = 1.23456789;

NSString *str7 = [NSString stringWithFormat:@"%g", x]; // 1.2345
NSString *str8 = [NSString stringWithFormat:@"%g", y]; // 1.23457