Objective-C แปลง int เป็น string
posted on 25 Feb 2009 23:58 by xnanoob in Other
int myInt = 360;
NSString* myNewString = [NSString stringWithFormat:@"%d", myInt];
หรือถ้าเป็น float ก็เป็น
float myFloat = 123.45;
NSString* myNewString = [NSString stringWithFormat:@"%f", myFloat ];
จดไว้อะ บายค่ะ
Tags: objective, xnanoob3 Comments







float f = 1.2;
NSString *str = [NSString stringWithFormat:@"%f", f];
#1 By xnanoob on 2010-02-19 16:55