Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.
Revision as of 05:34, 22 February 2025 by Prd (talk | contribs) (Created page with "{{Documentation subpage}} {{lua|Module:String}} {{Substitution|always|in the article namespace}} ==Usage== Converts the first ASCII letter character of a string to uppercase. This behavior is different from the magic word ucfirst, which affects the first character of a string regardless of whether it is a letter or not. ==Examples== {{demo inline|<nowiki>{{ucfirstletter|test}}</nowiki>}} {{demo inline|<nowiki>{{ucfirstletter|(test)}}</nowiki>}} {...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Usage

Converts the first ASCII letter character of a string to uppercase. This behavior is different from the magic word ucfirst, which affects the first character of a string regardless of whether it is a letter or not.

Examples

{{ucfirstletter|test}} → {{subst:#invoke:String|match|test|%A*}}{{subst:uc:{{subst:#invoke:String|sub|{{subst:#invoke:String|match|test|%a.*}}|1|1}}}}{{subst:#invoke:String|sub|{{subst:#invoke:String|match|test|%a.*}}|2}}

{{ucfirstletter|(test)}} → {{subst:#invoke:String|match|(test)|%A*}}{{subst:uc:{{subst:#invoke:String|sub|{{subst:#invoke:String|match|(test)|%a.*}}|1|1}}}}{{subst:#invoke:String|sub|{{subst:#invoke:String|match|(test)|%a.*}}|2}}

{{ucfirstletter|6th century}} → {{subst:#invoke:String|match|6th century|%A*}}{{subst:uc:{{subst:#invoke:String|sub|{{subst:#invoke:String|match|6th century|%a.*}}|1|1}}}}{{subst:#invoke:String|sub|{{subst:#invoke:String|match|6th century|%a.*}}|2}}

(compare to {{ucfirst:6th century}} → 6th century)

See also