我正在使用一個nsstring的長度並將其轉換爲nsstring。我需要這個最後一個字符串總是2個數字,所以例如字符串中的「hello」長度應該是「05」而不是「5」。如何獲得總是2位數字的nsstring中的nsstring的長度?
我迄今爲止代碼:
NSString *[email protected]"hello";
NSMutableString *result=[NSString stringWithFormat:@"%d", sth.length]; //string is "5" and not "05" that i need