 |
 |
 |
 |
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()
|
|
|