NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

String.Split (Char[])

Creates an array of strings by splitting this string with a specified separator.

[Visual Basic]
Overloads Public Function Split( _
   ByVal separator() As Char _
) As String ()
[C#]
public string[] Split(
   char[] separator
);
[C++]
public: String* Split(
   __wchar_t* separator[]
) [];
[JScript]
public function Split(
   separator : Char[]
) : String[];

Parameters

separator
The string used as the separator.

Return Value

Value Condition
An array containing the substrings of this string If they are separated by the separating string.
A one element array that holds Empty If this instance is an empty string.

Exceptions

Exception Type Condition
ArgumentException If the separating string is null.

Remarks

The separator is searched for and, if found, the substring preceding the occurrence is stored as the first element in the array of strings. It is continued in this manner by searching the substring that follows the occurrence.

On the other hand, if the separator is not found, the array of strings will contain this instance as its only element. If the separator is an empty array, whitespace (i.e., IsWhiteSpace) is used as the separator.

Example

"42,
12, 19".Split ({',', ' '}) => {"42", "",
"12", "", "19"}
"42..12..19".Split({'.'})
=> {"42", "", "12", "",
"19"} 
"Banana".Split({'.'})
=> {"Banana"} 
"Darb
Smarba".Split({}) => {"Darb", "Smarba"} 
"Darb
Smarba".Split(null) => {"Darb", "Smarba"}

See Also

String Class | String Members | System Namespace | String.Split Overload List | Char | CharacterInfo