NSMutableArray → NSArray
NSArray *array = [NSArray arrayWithArray:mutableArray]; //array is empty
NSArray *array = [mutableArray copy]; //array is nil
NSDate↔ NSString
NSDateFormatter *f = [[NSDateFormatter alloc] init];
[f setDateFormat:@"yyyy-MM-dd"];
NSString *strDate = [f stringFromDate:[NSDate date]];
NSDate *date = [f dateFromString:@"2015-10-04"];
NSNumber↔int
int i=10;
UUID/GUID→ NSString
NSNumber *inumber=[NSNumber numberWithInt:i];
i=[inumber intValue];
UUID/GUID→ NSString
NSString *UUID=[[NSUUID UUID] UUIDString];
int↔NSString
int↔NSString
int value=0;
NSString *str=[@(value) stringValue];
value =[str intValue];
沒有留言:
張貼留言