TC - text converter

TC: text converter (cut text, make it lowercase, uppercase, capitalized, use regular expressions…)

Syntax

tc(mode, text)

Arguments

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

Examples

FormulaDescription
$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(count, "To be or not to be", be)$Count the number of times a set of chars appears in text
$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(roman, "Year 476?")$Converts 476 into Roman numeral CDLXXVI
$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(url, "an URL parameter with 'strange!' symbols")$URL encode text using UTF-8 or supplied encoding
$tc(fmt, "Padded number '%05d' or text '%5s'", 3, foo)$Convert text and parameters using JAVA format standard
$tc(nfmt, "Total is 30000.12")$Converts numbers to proper locale format
$tc(lines, "This is two lines")$Return number of lines on a given text
$tc(json, "{'a':1,'b':2}", ".a")$Parse string as a JSON Path expression and return result
$tc(type, "Это лучшее приложение в мире!")$Returns text type of the string, one of:: LATIN, NUMBER, ARABIC, CYRILLIC, GREEK, HIRAGANA, KATAKANA, CJK
$tc(asort, "zebra apple banana")$Sorts words alphabetically
$tc(asort, "cherry:apple:banana", ":", "desc")$Sorts words in descending alphabetical order
$tc(nsort, "3,1,2", ",")$Sorts numbers numerically
$tc(nsort, "afoo2:blabla3:zebra1", ":")$Extract numbers and sort words by extracted numbers



Privacy Policy