Share via


String.Split Method (Char[])

Identifies the substrings in the current String object that are delimited by one or more characters specified in an array, and then places the substrings in a String array.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

Syntax

[MethodImplAttribute]
public string [] Split (
         char[] separator
)

Parameters

  • separator
    [ParamArrayAttribute] An array of Unicode characters that delimit the substrings in the current String object, an empty array that contains no delimiters, or a null reference.

Return Value

An array consisting of a single element that contains the current String object, if this object contains none of the characters specified in the separator parameter.

-or-

An array of substrings if the current object is delimited by one or more of the characters in separator.

-or-

An array of the substrings in the current object, delimited by white-space characters, if those characters occur in the object and separator is a null reference or contains no delimiter characters.

Note that the Empty field is returned for any substring in which two delimiters are adjacent, or if a delimiter is found at the beginning or end of the current object.

Delimiter characters are not included in the substrings.

Version Information

Available in the .NET Micro Framework versions 2.0, 2.5, 3.0, 4.0, and 4.1.

See Also

Reference

String Class
String Members
System Namespace