Methods for Working with the Register
Trim
The trim command is used to remove all leading and trailing spaces from the contents of the register. It does not have any arguments. Same functionality you can achieve using normalization command, but using this command will make your code shorter and easier readable. The command is available only in the block context, because it manipulates the contents of the register.
Below are examples of using trim in the code:
- find:
path: a.somepath
do:
# PARSE TEXT CONTENT OF CURRENT BLOCK
- parse
# IN THE REGISTER: " The link is absent "
# LETS TRIM IT
- trim
# IN THE REGISTER: "The link is absent"
Next, we'll find out how you can additionally filter the data in the register.