I\'ve been trying to make a dynamic string format so that through user options precision or padding could be somewhat user defined.
An example includes, the padding of
I think you could build up your format in an entirely separate stage, then use that. Also, don't forget to escape one of the %'s to make it literal.
NSString *format = [NSString stringWithFormat:@"%%%@i", padding];
NSString *result = [NSString stringWithFormat:@"Hour: %@", format];
update: oops maddy's answer pointed out a problem with mine: to escape a %, you should use %%, not \%. answer updated.