asp.net.ph

String.Split Method ( Char [ ] )

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 [ ];

Parameters

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 ).

Return Value

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.

Remarks

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"}

See Also

String Members   String.Split Overload List   Char   Concat   Insert   Join   Remove   Replace   Substring   Trim Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph