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.
IndexProgramming Questions & HelpPrograms › Convert string array to int array...
Page Index Toggle Pages: 1
Convert string array to int array... (Read 509 times)
Convert string array to int array...
Jul 6th, 2008, 4:06am
 
Hello!!  I've been looking around and I've been unable to find an answer to this question.  I've found other array conversions and also the ability to convert certain variables, but not this type of conversion.  Is there a predefined function that does this or do I need to create a function to do this?  Any help would be appreciated.  Thanks...
Re: Convert string array to int array...
Reply #1 - Jul 6th, 2008, 11:38am
 
just use the int()function?

int n=int("3");
// String "3" converted to integer 3

Re: Convert string array to int array...
Reply #2 - Jul 6th, 2008, 2:09pm
 
String[] numbersS = { "1", "11", "42", "gah" };
int[] numbersI = int(numbersS);
println(numbersI);
Page Index Toggle Pages: 1