functx:capitalize-first
Capitalizes the first character of a string
Description
The functx:capitalize-first function capitalizes the first character of $arg. If the first character is not a lowercase letter, $arg is left unchanged. It capitalizes only the first character of the entire string, not the first letter of every word.
Parameters |
Description |
|---|---|
arg:string() |
the word or phrase to capitalize |
Examples
XPath |
Results |
|---|---|
functx:capitalize-first('hello') |
Hello |
functx:capitalize-first('hello world') |
Hello world |
functx:capitalize-first('Hello world') |
Hello world |
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-capitalize-first.
[e] example-functx-capitalize-first
[e] start
[e] match
[v] /
[e] body
[e] write-pattern
[v] examples
[e] patterns
[e] examples
[v] E01: {{ functx:capitalize-first('hello') }}
[v] E02: {{ functx:capitalize-first('hello world') }}
[v] E03: {{ functx:capitalize-first('Hello world') }}