What will the following code print in the Processing message window?
// Splitting a String based on multiple delimiters    
String stuff = "hats  &  apples, cars + phones % elephants dog." ;   
String[] list = splitTokens(stuff,  " & ,+. " );   
for (int i = 0; i < list.length; i++ )  {   
  println(list[i] + " " + i);      
} 
Answer:
hats 0
apples 1
cars 2
phones 3
% 4
elephants 5
dog 6


»

No comments yet.

Leave a comment