Split: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
(Created page with "SPLIT(''string''[, ''delimiter''[, ''count''[, ''compare'']]]) '''Description''' SPLIT returns a one-dimensional array of strings of a specified length, created by dividing ...")
 
No edit summary
Line 1: Line 1:
SPLIT(''string''[, ''delimiter''[, ''count''[, ''compare'']]])
Split(''string''[, ''delimiter''[, ''count''[, ''compare'']]])


'''Description'''
== Description ==


SPLIT returns a one-dimensional array of strings of a specified length, created by dividing a single string where a specified delimiter occurs. The required parameter, ''string'', is a valid string expression; if ''string'' is a zero-length string (""), SPLIT returns an empty array. The optional argument, ''delimiter'', is a string expression whose first character is used to separate the substrings; if ''delimiter'' is a zero-length string (""), a single-element array containing the entire string is returned. The optional parameter, ''count'', is a numeric expression that specifies the number of substrings to return; if ''count'' is not provided -1 is used as a default specifying that all substrings be returned. The optional parameter, ''compare'', is used to specify the type of search performed.
Split returns a one-dimensional array of strings of a specified length, created by dividing a single string where a specified delimiter occurs. The required parameter, ''string'', is a valid string expression; if ''string'' is a zero-length string (""), Split returns an empty array. The optional argument, ''delimiter'', is a string expression whose first character is used to separate the substrings; if ''delimiter'' is a zero-length string (""), a single-element array containing the entire string is returned. The optional parameter, ''count'', is a numeric expression that specifies the number of substrings to return; if ''count'' is not provided -1 is used as a default specifying that all substrings be returned. The optional parameter, ''compare'', is used to specify the type of search performed.




'''Example'''
== Example ==


<pre>
<pre>
REM SPLIT Example
Rem Split Example
'SPLIT divides a string into substrings
'Split divides a string into substrings
DIM List, Who, All, TopTwo
Dim List, Who, All, TopTwo
List = "Eric,Kenny,Kyle,Stan"
List = "Eric,Kenny,Kyle,Stan"
Who = SPLIT(List, ",")
Who = Split(List, ",")
PRINT Who(0), Who(1), Who(2), Who(3)
Print Who(0), Who(1), Who(2), Who(3)
All = "First Second Third Fourth Fifth"
All = "First Second Third Fourth Fifth"
TopTwo = SPLIT(All, " ")
TopTwo = Split(All, " ")
PRINT TopTwo(0), TopTwo(1)
Print TopTwo(0), TopTwo(1)
</pre>
</pre>


'''Output'''
== Output ==


<pre>
<pre>
Line 27: Line 27:
</pre>
</pre>


'''Related Items'''
== Related Items ==


[[join|JOIN]]
[[join|JOIN]]
[[Category:Language Reference]]

Revision as of 03:24, 17 August 2012

Split(string[, delimiter[, count[, compare]]])

Description

Split returns a one-dimensional array of strings of a specified length, created by dividing a single string where a specified delimiter occurs. The required parameter, string, is a valid string expression; if string is a zero-length string (""), Split returns an empty array. The optional argument, delimiter, is a string expression whose first character is used to separate the substrings; if delimiter is a zero-length string (""), a single-element array containing the entire string is returned. The optional parameter, count, is a numeric expression that specifies the number of substrings to return; if count is not provided -1 is used as a default specifying that all substrings be returned. The optional parameter, compare, is used to specify the type of search performed.


Example

Rem Split Example
'Split divides a string into substrings
Dim List, Who, All, TopTwo
List = "Eric,Kenny,Kyle,Stan"
Who = Split(List, ",")
Print Who(0), Who(1), Who(2), Who(3)
All = "First Second Third Fourth Fifth"
TopTwo = Split(All, " ")
Print TopTwo(0), TopTwo(1)

Output

Eric          Kenny  Kyle          Stan
First  Second

Related Items

JOIN