We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
Minutes (Read 516 times)
Minutes
Sep 30th, 2007, 1:57am
 
is there an easy way to break a number returned from minute() into two numbers? for example... 27 becomes 2 and 7.

thanks,
jc



Re: Minutes
Reply #1 - Sep 30th, 2007, 2:11am
 
Never mind, converting it to a String should be fine. Thanks.
Re: Minutes
Reply #2 - Oct 1st, 2007, 1:26pm
 
more efficient is to use modulo (%) rather than a String:

Code:

int m = minute();
int left = m / 10;
int right = m % 10;


though of course that depends on how you're actually using the result.. if it's a string being printed to the console or drawn as text, then you may as well use a String Wink
Page Index Toggle Pages: 1