trim
Module Export
text |> textRemoves leading and trailing whitespace and tab characters from a text value.
Example
import { trim } from 'text'
from ' hello world ' trim// Returns: "hello world"
from '\t\thello world\t\t' trim// Returns: "hello world"
from ' \t hello world \t ' trim// Returns: "hello world"
from ' hello world ' trim// Returns: "hello world"
from '' trim// Returns: ""
from ' \t ' trim// Returns: ""
from 'hello' trim// Returns: "hello"Notes
- Removes all leading and trailing whitespace characters (spaces, tabs, newlines, etc.)
- Preserves internal whitespace within the text
- Works with empty strings and whitespace-only strings
- Returns the original text if no leading or trailing whitespace is found