System Namespace String Class
Identifies the substrings in the given String that are delimited by one or more characters specified in an array, then places the substrings into a String array.
[ VB ]
<Serializable>
Overloads Public Function Split ( _
ByVal ParamArray separator ( ) As Char _
) As String ( )
[ C# ]
[ Serializable ]
public string [ ] Split (
params char [ ] separator
);
[ C++ ]
[ Serializable ]
public: String* Split (
__wchar_t separator __gc [ ]
) __gc [ ];
[ JScript ]
public Serializable
function Split (
separator : Char [ ]
) : String [ ];
- separator
- An array of Unicode characters that delimit the substrings in the given String, an empty array containing no delimiters, or a null reference ( Nothing in Visual Basic ).
An array consisting of a single element containing this instance, if this instance contains none of the characters in separator.
-or-
An array of substrings if this instance is delimited by one or more of the characters in separator.
-or-
An array of the substrings in the given String delimited by white space characters if those characters occur and separator is a null reference ( Nothing in Visual Basic ) or contains no delimiter characters.
Empty is returned for any substring where two delimiters are adjacent, or a delimiter is found at the beginning or end of this instance.
Delimiter characters are not included in the substrings.
For example:
Input |
separator |
Output |
"42, 12, 19" |
new Char [ ] {',', ' '} |
{"42", "", "12", "", "19"} |
"42..12..19" |
new Char [ ] {'.'} |
{"42", "", "12", "", "19"} |
"Banana" |
new Char [ ] {'.'} |
{"Banana"} |
"Darb\nSmarba" |
new Char [ ] {} |
{"Darb", "Smarba"} |
"Darb\nSmarba" |
null |
{"Darb", "Smarba"} |
String Members String.Split Overload List Char Concat Insert Join Remove Replace Substring Trim