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 › using " as a delimiter in split()
Page Index Toggle Pages: 1
using " as a delimiter in split() (Read 628 times)
using " as a delimiter in split()
Nov 8th, 2006, 10:56pm
 
I've trying to use split to break a long string into individual words. This syntax works fine to remove some charachters...

String myList[] = split(myString, "[,?.)( "]");

but I can't figure out how to use a "

this doesn't work

String myList[] = split(myString, "\\"");

any advice?
Re: using " as a delimiter in split()
Reply #1 - Nov 8th, 2006, 11:13pm
 
you only need a single \ before the "

Code:
String Text="foo\"bar\"baz";
String[] words=split(Text,"\"");
for(int i=0;i<words.length;i++)
{
println(i+" "+words[i]);
}
Page Index Toggle Pages: 1