functx:left-trim
Trims leading whitespace
Description
The functx:left-trim function removes all whitespace at the beginning of a string. Whitespace is defined as it is in XML, namely as the characters space, tab, carriage return and line feed. If $arg is the empty sequence, it returns a zero-length string.
Parameters |
Description |
|---|---|
arg:string() |
the string to trim |
Examples
XPath |
Results |
|---|---|
functx:left-trim(' xyz') |
xyz |
functx:left-trim(' xyz x') |
xyz x |
functx:left-trim('xyz') |
xyz |
In a generator
Copy the snippet below and paste it in Freemapper, under a language node inside the generators element. Each line of the pattern prints the result of one example; to see them, run mi generate <project> <language> example-functx-left-trim.
[e] example-functx-left-trim
[e] start
[e] match
[v] /
[e] body
[e] write-pattern
[v] examples
[e] patterns
[e] examples
[v] E01: {{ functx:left-trim(' xyz') }}
[v] E02: {{ functx:left-trim(' xyz x') }}
[v] E03: {{ functx:left-trim('xyz') }}