Re: Newbie probably not retaining himself to well... (off list)
Re: Newbie probably not retaining himself to well... (off list)
- Subject: Re: Newbie probably not retaining himself to well... (off list)
- From: Alexander Griekspoor <email@hidden>
- Date: Thu, 20 Jun 2002 10:13:41 +0200
>
> -----Original Message-----
>
> From: Alexander Griekspoor [mailto:email@hidden]
>
>
>
> Aha, that makes sense... So I changed:
>
>
>
>>> if([startdate minuteOfHour] < 10){
>
>>> starttime = [NSString stringWithFormat: @"%d:0%d",
>
>>> [startdate hourOfDay], [startdate minuteOfHour]];
>
>>> }
>
>
>
>
>
> into:
>
>
>
> if([startdate minuteOfHour] < 10){
>
> starttime = [[NSString alloc] initWithString: [NSString
>
> stringWithFormat: @"%d:0%d",
>
> [startdate hourOfDay], [startdate minuteOfHour]]];
>
> }
>
>
>
> With removal of the alloc/init of starttime in the init method.
>
> If you have any suggestions on a better or more elegant way,
>
> please tell me,
>
> but yes it works perfectly!!!! Thanks a lot. A happy newbie...
>
>
>
>
starttime = [NSString stringWithFormat: @"%d:d",
>
[startdate hourOfDay], [startdate minuteOfHour]];
>
>
See man 3 printf for details. (Pad with zeros - minimum width 2)
>
>
No need for if statements.
>
>
Carl Gherardi
>
Thanks!!! I would almost send all my code line by line to this list,
kiddin'!
Seems like three hours of thinking and trying to solve the missing string
stuff is solved in one minute, but no worries, as a newbie I'll keep on
trying 3 hours on my next big problem before posting it here...
Alex
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.