Split: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
C185driver (talk | contribs)
Line 3: Line 3:
== 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 not specified, ''delimiter'' defaults to a space character; 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 (""), a single-element array containing the entire expression string is returned. The optional argument, ''delimiter'', is a string expression whose first character is used to separate the substrings; if not specified, ''delimiter'' defaults to a space character; 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.


'''Table: Comparison constants'''
'''Table: Comparison constants'''

Revision as of 11:52, 29 December 2017

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 (""), a single-element array containing the entire expression string is returned. The optional argument, delimiter, is a string expression whose first character is used to separate the substrings; if not specified, delimiter defaults to a space character; 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.

Table: Comparison constants

Constant Value Description
vbBinaryCompare 0 Binary comparison case sensitive (default)
vbTextCompare 1 Textual comparison, case insensitive

Example (Basic)

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)

Example (JavaScript)

// Split Example
/* Split divides a string into substrings */

var List, Who, All, TopTwo;
List = "Eric,Kenny,Kyle,Stan";
Who = List.split(",");
NSB.Print(Who[0] + " " + Who[1] + " " + Who[2] + " " + Who[3]);
All = "First Second Third Fourth Fifth";
TopTwo = All.split(" ");
NSB.Print(TopTwo[0] + " " + TopTwo[1]);

Output

Eric          Kenny  Kyle          Stan
First  Second

Related Items

Join