CorString: Split

Split

Splits a string into a maximum number of substrings based on the strings or characters in an array. You can specify whether the substrings include empty array elements.



 Public Function Split(
	  ByRef s As String,
	  ByRef Separator As Variant,
	  Optional ByVal Count As Long = &H7FFFFFFF,
	  Optional ByVal Options As StringSplitOptions = StringSplitOptions. None ) As String ( )

Parameters

s
[ByRef] String. The string to split.
Separator
[ByRef] Variant. A String or Integer array that delimits the substrings in the s parameter, an empty array that contains no delimiters, or null.
Count
[ByVal] Optional. Long. The maximum number of substrings to return.  

Default: &H7FFFFFFF

Options
[ByVal] Optional. StringSplitOptions. StringSplitOptions.RemoveEmptyEntries to omit empty array elements from the array returned; or StringSplitOptions.None to include empty array elements in the array returned.  

Default: StringSplitOptions . None

Return Values

String() -  An array whose elements contain the substrings in this string that are delimited by one or more strings in Separator. For more information, see the Remarks section.

Remarks

Delimiter strings are not included in the elements of the returned array.

If the s parameter does not contain any of the strings or characters in Separator, or the Count parameter is 1, the returned array consists of a single element that contains the s parameter. If the Separator parameter is null or contains no elements, white-space characters are assumed to be the delimiters. White-space characters are defined by the Unicode standard and return True if they are passed to the Char.IsWhiteSpace method.

If the Count parameter is zero, or the Options parameter is RemoveEmptyEntries and the length of the s parameter is zero, an empty array is returned.

Exceptions

Exception Condition
ArgumentOutOfRangeExceptionCount is negative.
ArgumentExceptionOptions is not one of the StringSplitOptions values.

See Also

Project CorLib Overview

Class CorString Overview