Re: string formatting
Re: string formatting
- Subject: Re: string formatting
- From: Hank Heijink <email@hidden>
- Date: Wed, 3 Oct 2007 16:31:06 -0400
It's in the documentation on the string format specifiers: %.2d gives
you a leading zero when the argument is only one digit.
Hank
On Oct 3, 2007, at 4:14 PM, H M wrote:
hi.
I have written a method that puts out an NSstring like
"12h12m12.34s" using a string format. that works ok, but there is
something I don't like: when the number of minutes or seconds is
less than 10, it'll put out only 1 digit instead of 2. like this:
"1h1m1.23s". is there a way to force leading zeros in there, like
this: "1h01m01.23s"? i don't need a leading zero for the hours.
Do I have to make 3 NSstrings (for hours, minutes and seconds) with
leading zeros and then stick them together? I think I can get that
sorted, but that would be a lot of work. is there an easier way?
--
GPG Key ID: 92AD877F7E4E32B9
Fingerprint: 16B0 7DCD 3AB0 0C45 F5FD 581D 92AD 877F 7E4E 32B9
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
40runbox.com
This email sent to email@hidden
Hank Heijink
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden