Files
processing4/mobile/web/reference/API/split.xml
2005-01-27 06:48:42 +00:00

73 lines
1.8 KiB
XML

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root>
<name>split()</name>
<category>Data</category>
<subcategory>String Functions</subcategory>
<usage>Web &amp; Application</usage>
<example>
<image></image>
<code>
String numbers = "Putin Yeltsin Gorbachev";
String list[] = split(numbers);
// list[0] is now Putin, list[1] is now Yeltsin, ...
</code>
</example>
<example>
<image></image>
<code>
String numbers = "Chernenko,Andropov,Brezhnev";
String list[] = splitInts(numbers, ',');
// list[0] is now Chernenko, list[1] is Andropov, ...
</code>
</example>
<example>
<image></image>
<code>
String numbers = "8 67 5 309";
int list[] = int(splitInts(numbers));
// list[0] is now 8, list[1] is now 67, ...
</code>
</example>
<description>
A utility function which separates a series of data embedded into a String into an array of Strings. The <b>delim</b> parameter specifies the character or characters which mark the boundaries between each data element. If no <b>delim</b> 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 <b>int()</b> and <b>float()</b> to convert the array of Strings (see example above).
</description>
<syntax>
split(<c>str</c>)
split(<c>str</c>, <c>delim</c>)
</syntax>
<parameter>
<label>str</label>
<description>the string to be split</description>
</parameter>
<parameter>
<label>delim</label>
<description>the character or String used to separate the data</description>
</parameter>
<returns>String[]</returns>
<related>
join()
</related>
<availability>1.0</availability>
<type>Function</type>
<partof>Core</partof>
<level>Extended</level>
</root>