I am taking the length of a nsstring and converting it to nsstring. I need this last string always 2 digits long, so for example word “hello”‘s length in string would be “05” and not “5”.
My code so far:
NSString *sth=@"hello";
NSMutableString *result=[NSString stringWithFormat:@"%d", sth.length]; //string is "5" and not "05" that i need
Add .2 after % sign(similar as with floating numbers and decimal part).