The split function can be used in ASP and Asp.net to process strings conveniently.
The split function returns a zero-dimensional array containing a specified number of substrings.
Syntax
Split (expression [, delimiter [, Count [, start])
The syntax of the split function includes the following parameters:
Parameter description
Expression is required. A string expression that contains a substring and a separator. If expression is a zero-length string, split returns an empty array, that is, an array that does not contain elements and data.
Delimiter is optional. Character used to identify the substring boundary. If omitted, use space ("") as the separator. If Delimiter is a zero-length string, a single element array containing the entire expression string is returned.
Count is optional. Number of substrings to be returned.-1 indicates that all substrings are returned.
Compare is optional. Indicates the value of the comparison type used to calculate the substring. For values, see the "Settings" section.
Set
The compare parameter can have the following values:
Constant Value description
Vbbinarycompare 0 performs binary comparison.
Vbtextcompare 1 performs text comparison.
Description
The following example uses the split function to return an array from a string. The function compares the delimiters and returns all substrings.
ASP
Dim mystring, myarray
Mystring = Split ("vbscriptxisxfun! "," X ",-1, 1)
'Mystring (0) contains "VBScript ".
'Mystring (1) contains "is ".
'Mystring (2) contains "fun! ".
Asp.net
String TMP = "SD, SSDS ";
String [] Mm = TMP. Split (',');