xtd 0.2.0
Loading...
Searching...
No Matches

◆ split() [1/5]

std::vector< ustring > xtd::ustring::split ( const std::vector< value_type > &  separators,
size_t  count,
string_split_options  options 
) const
noexcept

Splits this string into a maximum number of substrings based on the characters in an array.

Parameters
separatorsA character array that delimits the substrings in this string, an empty array that contains no delimiters.
countThe maximum number of substrings to return.
optionsxtd::string_split_options::remove_empty_entries to omit empty array elements from the array returned; or None to include empty array elements in the array returned.
Returns
An array whose elements contain the substrings in this string that are delimited by one or more characters in separators. For more information, see the Remarks section.
Remarks
Delimiter characters are not included in the elements of the returned array.
If the specified string does not contain any of the characters in separator, or the count parameter is 1, the returned array consists of a single element that contains the specified string.
If the count parameter is zero, or the options parameter is remove_empty_entries and the length of the specified string is zero, an empty array is returned.
Each element of separator defines a separate delimiter character. If the options parameter is None, and two delimiters are adjacent or a delimiter is found at the beginning or end of the specified string, the corresponding array element contains an empty string.
If there are more than count substrings in the specified string, the first count minus 1 substrings are returned in the first count minus 1 elements of the return value, and the remaining characters in the specified string are returned in the last element of the return value.
If count is greater than the number of substrings, the available substrings are returned.
Examples
split.cpp.