We often need to turn a number into a string and use description when you don't need to match other strings.
1 /**2 description belongs to NSObject3 The value is NSNumber time, not stringwithformate to convert to a string. Much easier4 It is useful when parsing/assigning, when we need nsstring, the data to us is NSNumber .5 */6 7 //The NSNumber is taken from the dictionary.8Nsdictionary * Dict = @{9 @"a":@1,Ten @"two":@2, One @"three":@3}; A //the removed NSNumber was converted into nsstring. -NSString * str = [dict[@"two"] description]; -NSLog (@"str=%@", str); the - //extracting data from a dictionary is nsstring -Nsdictionary * Dict2 = @{@"1":@"a", - @"2":@"two", + @"3":@"three"}; - //because it's a string, the description method here doesn't really work. +NSString * str2 = [dict2[@"2"] description]; ANSLog (@"str2=%@", str2);
IOS NSNumber Conversion NSString Description