FAQ
 
 
Cover  \ Exhibition  \ Learning  \ Reference  \ Download  \ Discourse   
      Language \ Environment \ Libraries \ Comparison
 
   
   
Abridged (A-Z) \ Complete (A-Z)  
   
  Reference for Processing (BETA) version 91+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.  
Name  

split()

   
Examples  
String men = "Putin Yeltsin Gorbachev"; 
String list[] = split(men);
// list[0] is now Putin, list[1] is now Yeltsin, ...


String men = "Chernenko,Andropov,Brezhnev"; 
String list[] = split(men, ',');
// list[0] is now Chernenko, list[1] is Andropov, ...


String numbers = "8 67 5 309"; 
int list[] = int(split(numbers));
// list[0] is now 8, list[1] is now 67, ...

Description   A utility function which separates a series of data embedded into a String into an array of Strings. The delim parameter specifies the character or characters which mark the boundaries between each data element. If no delim character is specified, a whitespace character is used as the split character. Whitespace characters include tab (\t), line feed (\n), carriage return (\r), and form feed (\f), and space. To convert a String to an array of integers or floats, use the datatype conversion functions int() and float() to convert the array of Strings (see example above).
   
Syntax  
split(str)
split(str, delim)
   
Parameters  
str   the string to be split

delim   the character or String used to separate the data

   
Returns   String[]
   
Usage   Web & Application
   
Related   join()
 
 






   
 
Updated: Fri Jul 15 16:36:10 PDT 2005
 
 








Creative Commons License
 
  Processing is an open project initiated by Ben Fry and Casey Reas  
  © Info