Hi,
I need to output some numbers to an NSTextField. The numbers are unsigned short ints, and I need to output them in the form ****h in hexadecimal, where number is zero-padded at the beginning if it is <0x1000. Currently, I'm using:
[AFbox setStringValue:[NSString stringWithFormat
"%4Xh", [cpu AF]]];
But I really can't see a good way of zero-padding the string...can someone point me in the right direction? ([cpu AF returns the unsigned short ints).
Many thanks,
Wrayal
[edit: I have tried stringByPaddingToLength:withString:startingAtIndex:, but this will only pad at the end as far as I can tell]
I need to output some numbers to an NSTextField. The numbers are unsigned short ints, and I need to output them in the form ****h in hexadecimal, where number is zero-padded at the beginning if it is <0x1000. Currently, I'm using:
[AFbox setStringValue:[NSString stringWithFormat
But I really can't see a good way of zero-padding the string...can someone point me in the right direction? ([cpu AF returns the unsigned short ints).
Many thanks,
Wrayal
[edit: I have tried stringByPaddingToLength:withString:startingAtIndex:, but this will only pad at the end as far as I can tell]