"split" (string::split)
Splits the string into substrings wherever sep occurs, and returns the list of those strings.
Synopsis
vector<string> split(string sep, SplitBehavior behavior =
KeepEmptyParts);
Parameters
| Parameter | Description |
|---|---|
| sep | Separator |
| behavior | Behavior that should be used for splitting. |
Description
Splits the string into substrings wherever sep occurs, and returns the list of those strings. If sep does not match anywhere in the string, split() returns a single-element list containing this string.
If behavior is string::SkipEmptyParts, empty entries do not appear in the result. By default, empty entries are kept.
There are 2 special enum values possible here: string::KeepEmptyParts or string::SkipEmptyParts
Example
main()
{
string csv = ";A;;B;";
vector<string> keep = csv.split(";", string::KeepEmptyParts);
vector<string> skip = csv.split(";", string::SkipEmptyParts);
DebugN(keep);
DebugN(skip);
}
Console output:
WCCOAui1:["","A","","B",""]
WCCOAui1:["A","B"]
