TC: Text converter (lowercase, uppercase, capitalized, regexp)

Syntax

tc(mode, text)

Arguments

  • mode: Conversion mode, "l" for lowercase, "u" for uppercase, "c" for capitalize
  • text: Text to convert

Examples

Formula Description
$tc(low, "sOme tExT")$ Convert text to lower case
$tc(up, "sOme tExT")$ Convert text to upper case
$tc(cap, "sOme tExT")$ Capitalize words in text
$tc(cut, "sOme tExT", 4)$ Will print only first 4 chars
$tc(ell, "sOme tExT", 4)$ Will ellipsize (so cut and add "…") if text is longer than 4 chars
$tc(cut, "sOme tExT", 2, 5)$ Prints 5 chars starting after the second
$tc(cut, "sOme tExT", -2)$ Prints last 2 chars
$tc(utf, "201")$ Will render utf code 0x201 (advanced, for font icons)
$tc(len, "sOme tExT")$ Will return the length of text
$tc(n2w, 42)$ Converts numbers to words
$tc(ord, 1)$ Renders ordinal suffix for number 1 (st)
$tc(lpad, 5, 10, 0)$ Will left pad the string to 'n' chars length using the provided string (or 0 by default)
$tc(rpad, 5, 10, 0)$ Will right pad the string to 'n' chars length using the provided string (or 0 by default)
$tc(split, "SuperXOneXZed", "X", 1)$ Split string by char X and prints second segment
$tc(reg, "Foobar one", "o+", X)$ Will replace text matching "o+" regexp with a capital X
$tc(html, "<b>Four</b> is %gt; than 3")$ Converts HTML text into plain text
$tc(nfmt, "Total is 30000.12")$ Converts numbers to proper locale format
Was this article helpful?
0 out of 0 found this helpful