capitalize: Difference between revisions
m (Conversion script moved page Capitalize to capitalize: Converting page titles to lowercase) |
m (Text replacement - "source>" to "syntaxhighlight>") |
||
Line 11: | Line 11: | ||
capitalize(input) | capitalize(input) | ||
capitalize(input, treatNumbersSymbolsAsBoundaries) | capitalize(input, treatNumbersSymbolsAsBoundaries) | ||
</ | </syntaxhighlight> | ||
'''Parameters''' | '''Parameters''' | ||
{{param|input|String to be converted.}} | {{param|input|String to be converted.}} | ||
Line 20: | Line 20: | ||
[r: name = getTokenName()]<br> | [r: name = getTokenName()]<br> | ||
[r: capitalize(name)] | [r: capitalize(name)] | ||
</ | </syntaxhighlight> | ||
Returns: | Returns: | ||
<source lang="mtmacro"> | <source lang="mtmacro"> | ||
ichabod crane | ichabod crane | ||
Ichabod Crane | Ichabod Crane | ||
</ | </syntaxhighlight> | ||
String with numbers and symbols. | String with numbers and symbols. | ||
<source lang="mtmacro" line> | <source lang="mtmacro" line> | ||
[r: capitalize("a 4ever 2/una")] | [r: capitalize("a 4ever 2/una")] | ||
</ | </syntaxhighlight> | ||
Returns: | Returns: | ||
<source lang="mtmacro"> | <source lang="mtmacro"> | ||
A 4Ever 2Una | A 4Ever 2Una | ||
</ | </syntaxhighlight> | ||
==== Since 1.8 ==== | ==== Since 1.8 ==== | ||
String with numbers and symbols: | String with numbers and symbols: | ||
Line 41: | Line 41: | ||
[r: capitalize(vLine)] | [r: capitalize(vLine)] | ||
[r: capitalize(vLine, 0)] | [r: capitalize(vLine, 0)] | ||
</ | </syntaxhighlight> | ||
Returns: | Returns: | ||
<source lang="mtmacro"> | <source lang="mtmacro"> | ||
He'S Sure I'Ll See You 1St, O'Shea | He'S Sure I'Ll See You 1St, O'Shea | ||
He's Sure I'll See You 1st, O'shea | He's Sure I'll See You 1st, O'shea | ||
</ | </syntaxhighlight> | ||
|also= | |also= | ||
{{func|upper}} {{func|lower}} | {{func|upper}} {{func|lower}} |
Revision as of 17:53, 14 March 2023
capitalize() Function
Usage
<source lang="mtmacro" line> capitalize(input) capitalize(input, treatNumbersSymbolsAsBoundaries) </syntaxhighlight> Parameters
input
- String to be converted.treatNumbersSymbolsAsBoundaries
- Since 1.8. Whether numbers and symbols should be treated as word boundaries - defaults totrue
(1
).
Example
<source lang="mtmacro" line>
[r: name = getTokenName()]
[r: capitalize(name)]
</syntaxhighlight>
Returns:
<source lang="mtmacro">
ichabod crane
Ichabod Crane
</syntaxhighlight>
String with numbers and symbols. <source lang="mtmacro" line> [r: capitalize("a 4ever 2/una")] </syntaxhighlight> Returns: <source lang="mtmacro"> A 4Ever 2Una </syntaxhighlight>
Since 1.8
String with numbers and symbols: <source lang="mtmacro" line> [h: vLine = "he's sure i'll see you 1st, o'shea"] [r: capitalize(vLine)] [r: capitalize(vLine, 0)] </syntaxhighlight> Returns: <source lang="mtmacro"> He'S Sure I'Ll See You 1St, O'Shea He's Sure I'll See You 1st, O'shea
</syntaxhighlight>See Also
Version Changes
- 1.5.7 - Added function.
- 1.8 - Added optional param to control treatment of numbers and symbols as word boundaries.