base » substringBefore(text,delim,saveVar)
Description
This command save the portion of text
that is before delim
to a variable denoted as saveVar
.
Note that:
delim
must be specified. To denote space, use either thespace
character or(blank)
.- If
delim
is not found, thensaveVar
is set totext
. IOW, the entire content oftext
is saved under the variable namedsaveVar
. - Only the first occurrence of
delim
is considered.
Parameters
- text - the text where the substring operation is to be performed. Variable expansion is supported via the
${...}
syntax. - delim - the delimiter to use fore extract from
text
. Only first occurrence is considered. - saveVar - the variable to use for saving the result of the substring operation. If
delim
is not found intext
, thensaveVar
will be saved astext
.
Example
Script:
… and the output as follows: