Mono Class Library: System.String Overview | Members

System.String.Split Method

Returns substrings of the current instance that are delimited by the specified characters. [Edit]

public string[] Split (char[] separator, int count)

Parameters

separator
An array of Unicode characters that delimit the substrings in the current instance, an empty array containing no delimiters, or a null reference. [Edit]
count
A int containing the maximum number of array elements to return. [Edit]

Returns

A string array containing the results of the split operation as follows:

Return ValueDescription
A single-element array containing the current instance.None of the elements of separator are contained in the current instance.
A multi-element string array, each element of which is a substring of the current instance that was delimited by one or more characters in separatorAt least one element of separator is contained in the current instance.
A multi-element string array, each element of which is a substring of the current instance that was delimited by white space characters.The current instance contains white space characters and separator is a null reference or an empty array.
[Edit]

Exceptions

TypeReason
ArgumentOutOfRangeExceptioncount is negative. [Edit]

Remarks

string.Empty is returned for any substring where two delimiters are adjacent or a delimiter is found at the beginning or end of the current instance.

Delimiter characters are not included in the substrings.

If there are more substrings in the current instance than the maximum specified number, the first count -1 elements of the array contain the first count - 1 substrings. The remaining characters in the current instance are returned in the last element of the array.

[Edit]

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0