{lcfirst:string}

Description

Lowercases the first character of a string and leaves the rest unchanged. The AA counterpart of the PHP lcfirst function, but UTF-8 aware. Only the first character is touched, so a later capital letter (for example in an acronym or CamelCase word) is preserved. An empty input gives an empty result, and a string that starts with a digit or symbol is returned unchanged because there is no leading letter to lower. To uppercase the first character instead use ucfirst; to lowercase the whole string use strtolower.

Parameters

string required

The text whose first character is lowercased. The rest of the string is returned exactly as given. A bare colon ends the parameter, so escape a literal colon in the text as #:.

Examples

test{lcfirst:Hello}
Expectedhello
Actualhello
The everyday use - turn a capitalised word into its lowercase-initial form.
test{lcfirst:Hello World}
Expectedhello World
Actualhello World
lcfirst touches the first character only. The W in World keeps its capital.
test{lcfirst:NASA report}
ExpectednASA report
ActualnASA report
Only the very first letter is lowered, so the rest of an acronym is left as-is - here NASA becomes nASA.
test{lcfirst:hello}
Expectedhello
Actualhello
If the first character is already lowercase the string comes back identical.
test[{lcfirst:}]
Expected[]
Actual[]
An empty string produces an empty string. The square brackets are literal, added only to make the empty result visible.
test{lcfirst:123ABC}
Expected123ABC
Actual123ABC
There is no leading letter to lower, so a string starting with a digit or symbol is returned unchanged.
test{lcfirst:{strtoupper:make me loud}}
ExpectedmAKE ME LOUD
ActualmAKE ME LOUD
Commands compose. strtoupper uppercases the whole string first, then lcfirst lowers just the first character.
test{lcfirst:Ready#: set go}
Expectedready: set go
Actualready: set go
A bare colon ends the parameter, so {lcfirst:Ready: set go} would only receive Ready and return ready. Escape a literal colon as #: (written Ready#: set go) to pass the whole text - the result here is ready: set go.