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 & HelpSyntax Questions › equivalent to substring
Page Index Toggle Pages: 1
equivalent to substring (Read 725 times)
equivalent to substring
Oct 3rd, 2007, 10:56pm
 
Hey,

anyone has an idea how I could extract a certain part of a string?

For example, let's say I have the string "hello World". If I wanted to get the string from characters 2 to 4.

In javaScript & actionScript I would either use the subString() (or substr()). Is there any equivalent in Processing?
Re: equivalent to substring
Reply #1 - Oct 3rd, 2007, 10:58pm
 
yes, there's a substring method of a string.
e.g.:

Code:
String str="hello world";
String sub=str.substring(3,5); //start index, end index
Re: equivalent to substring
Reply #2 - Oct 4th, 2007, 4:48am
 
Sweet!! thanks.
I didn't find it in the Reference section of the site.
Re: equivalent to substring
Reply #3 - Oct 4th, 2007, 2:15pm
 
You can find usefull informations there http://www.processing.org/reference/ too
Page Index Toggle Pages: 1