strip/3—remove blank spaces from specified parts of a string
The strip/3 function removes blank spaces from specified parts of a string. The general syntax for this function is as follows:
strip/3 arguments
Argument | Mode | Type | Description |
---|---|---|---|
$STR | Input | STRING | Specifies the base string from which blank spaces at a specified position are to be removed |
$POS | Input | INTEGER | Specifies the position within the base string from which blank spaces are to be removed |
$NEWSTR | Output | STRING | Resulting string after the blank spaces have been removed |
Use the strip/3 function to remove the blank spaces from position $POS within $STR and copy the resulting string into $NEWSTR.
The value of $POS determines the part or parts of the base string where the blank spaces are to be removed. Only the three least significant bits are considered, as shown:
Possible values for the $POS argument
$POS value | Binary value | Impacted part of the string |
---|---|---|
0 | 000 | None |
1 | 001 | End |
2 | 010 | Middle |
3 | 011 | Middle + end |
4 | 100 | Beginning |
5 | 101 | Beginning + end |
6 | 110 | Beginning + middle |
7 | 111 | Beginning + middle + end |
strip/3 example