strextract/4—retrieve a string of a specified length that begins at a specified position within a larger string
The strextract/4 function retrieves a string of a specified length that begins at a specified position within a larger string. The general syntax for this function is as follows:
$NEWSTR=strextract($STR,$POS,$LEN)
strextract/4 arguments
Argument | Mode | Type | Description |
---|---|---|---|
$STR | Input | STRING | Specifies the base string within which you want to retrieve another, partial, string that starts at $POS |
$POS | Input | INTEGER | Specifies the starting position for the partial string that you want to return |
$LEN | Input | INTEGER | Specifies the length (number of characters) of the partial string that you want to return |
$NEWSTR | Output | STRING | Retrieved string |
Use the strextract/4 function to return part of the string specified in the $STR argument into $NEWSTR. The returned part of the string starts at character position $POS and is $LEN characters long.
The $POS is determined by counting 1 as the first character of the string specified in $STR.
strextract/4 example