<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../style.css">
<title>
Gambas Documentation - Split
</title>
</head>
<table class="none" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr><td align="left">
<font size="-1">
<a href="../../help+en"><img class="flag" alt="Home" border="0" src="../../img/lang/en.png" align="center"></a>&nbsp;
<a href="../lang+en">Up</a>&nbsp;
<a href="space+en">Previous</a>&nbsp;
<a href="sqr+en">Next</a>&nbsp;
</td></tr></table>
<div class="notab">
<h1>
Split
</h1>
<div class="black"><font size="-2"><b>Syntax</b></font></div>
<pre class="syntax"><u>String Array</u> <b>= Split (</b> <u>String</u> AS String [ <b>,</b> <u>Separators</u> AS String <b>,</b> <u>Escape</u> AS String <b>,</b> <u>Ignore voids</u> AS Boolean ] <b>)</b></pre><p>

Splits a string into substrings delimited by separators and escape characters.
<p>
<ul>
<li><u>String</u> is the string to split.
<li><u>Separators</u> is a list of sperators characters.
<li><u>Escape</u> is an escape character. Any separator characters enclosed between two escape characters are ignored in the splitting process. If <u>Escape</u> contains two characters, then the first is the <i>starting</i> escape character, and the second the <i>ending</i> one.
<li><u>Ignore voids</u> tells Split() not to return void elements.
<p>
</ul>

This function returns a string array filled with each detected substring. Separators and escape characters are not returned.
<p>
By default, the comma character is the separator, and there are no escape characters.
<p>
<div class="gray"><font size="-2"><b>Example</b></font></div>
<pre class="example">DIM Elt AS String[]
DIM Sb AS String

Elt = Split(&quot; Gambas Almost Means BASIC  !n'Do you agree ?'&quot;, &quot; n&quot;, &quot;'&quot;)

FOR EACH Sb IN Elt
  PRINT &quot;(&quot;; Sb; &quot;) &quot;;
NEXT
PRINT
<hr>() (Gambas) (Almost) (Means) (BASIC) () (!) (Do you agree ?)</pre>
<p>
<div class="gray"><font size="-2"><b>Example</b></font></div>
<pre class="example">Elt = Split(&quot; Gambas Almost Means BASIC  !n'Do you agree ?'&quot;, &quot; n&quot;, &quot;'&quot;, TRUE)

FOR EACH Sb IN Elt
  PRINT &quot;(&quot;; Sb; &quot;) &quot;;
NEXT
PRINT
<hr>(Gambas) (Almost) (Means) (BASIC) (!) (Do you agree ?)</pre>
<p>
<div class="gray"><font size="-2"><b>Example</b></font></div>
<pre class="example">Elt = Split(&quot;(Gambas) (Almost) (Means) (BASIC) (!) (Do you agree ?)&quot;, &quot; &quot;, &quot;()&quot;)

FOR EACH Sb IN Elt
  PRINT Sb; &quot;.&quot;;
NEXT
PRINT
<hr>Gambas.Almost.Means.BASIC.!.Do you agree ?.</pre>
<p>
<hr><b>See also</b><br>
<a href="../cat/string+en">String Functions</a>&nbsp;

</div>
</body>
</html>

