Partager via


String.Split Method (Char[], Int32)

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,
         int count
)

Parameters

  • separator
    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.
  • count
    The maximum number of array elements to be returned.

Return Value

An array consisting of a single element that contains the current String object, if the 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 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, 4.1, and 4.2.

See Also

Reference

String Class
String Members
System Namespace