strtolist/3—divide a string into parts at specified separators
The strtolist/3 function divides a string into parts at specified separators. The syntax for this function is as follows:
$FLDS=strtolist($STR,$SEP)
strtolist/3 arguments
Argument | Mode | Type | Description |
---|---|---|---|
$STR | Input | STRING | Specifies the string to be divided into fields |
$SEP | Input | STRING | Specifies the separator(s) which separates the pieces of the string into fields |
$FLDS | Output | LIST_OF STRING | Retrieved fields |
Use the strtolist/3 function to divide a string $STR into pieces, separated by any character from $SEP and collect the fields in $FLDS.
The $FLDS argument can be specified as one variable that will get a list value or it can be specified as a list of as many variables as there are fields in the base string.
strtolist/3 example
The input string will be divided into pieces that are separated with forward slash or dot characters. The variable $FLDS will be set to the list [usr,bin,mcell,exe].