Description
The trim
function returns the provided string after removing all whitespace from the beginning and end. Whitespace includes:
- Regular spaces
- Tabs
- Line breaks or similar leading characters
Syntax
trim(string)
Arguments
Argument | Description |
---|---|
string |
The string from which the whitespace should be removed. |
Return Types
The function returns a cleaned string without leading and trailing whitespace.
Examples
Description | Formula | Result |
---|---|---|
String with spaces |
trim(" Smenso ") |
Returns "Smenso" |
String with tab |
trim("\tHello World\t") |
Returns "Hello World" |
Empty string |
trim("") |
Returns an empty string "" |
Notes
- Whitespace within the string: Whitespace within the string remains unchanged.
- No changes for empty strings: If an empty string (
""
) is passed, it remains unchanged.
Comments
0 comments
Please sign in to leave a comment.