Skip to main content
String manipulation helpers modify and transform text content.

trim

Removes whitespace from both ends of a string.
{{trim "  hello world  "}}
Output: hello world

truncate

Shortens text to a specified length with optional suffix.
{{truncate text 50}}
{{truncate text 50 "..."}}
{{truncate text 50 " [more]"}}
ArgumentTypeDefaultDescription
textstringrequiredText to truncate
lengthnumber100Maximum length
suffixstring”…”Suffix when truncated
Examples:
{{truncate "This is a very long description that needs to be shortened" 30}}
Output: This is a very long descriptio...
{{truncate description 100 " [read more]"}}

substring

Extracts a portion of a string.
{{substring text 0 10}}
ArgumentTypeDefaultDescription
textstringrequiredSource text
startnumber0Start index
endnumberend of stringEnd index
Examples:
{{substring "Hello World" 0 5}}
Output: Hello
{{substring "Hello World" 6}}
Output: World

replace

Replaces all occurrences of a string with another.
{{replace text "find" "replace"}}
ArgumentTypeDescription
textstringSource text
findstringString to find
replacestringReplacement string
Examples:
{{replace "Hello World" "World" "Universe"}}
Output: Hello Universe
{{replace phoneNumber "-" ""}}
<!-- Input: "555-123-4567" → Output: "5551234567" -->

repeat

Repeats a string a specified number of times.
{{repeat "=" 50}}
ArgumentTypeDefaultDescription
textstringrequiredText to repeat
timesnumber1Number of repetitions
Examples:
{{repeat "*" 5}}
Output: *****
<div class="separator">{{repeat "─" 40}}</div>

padStart

Pads the beginning of a string to reach a specified length.
{{padStart value 6 "0"}}
ArgumentTypeDefaultDescription
textstringrequiredText to pad
lengthnumber2Target length
padStringstring” “Padding character
Examples:
{{padStart "42" 6 "0"}}
Output: 000042
Invoice #{{padStart invoiceNumber 8 "0"}}
<!-- Input: 123 → Output: Invoice #00000123 -->

padEnd

Pads the end of a string to reach a specified length.
{{padEnd value 10 "."}}
ArgumentTypeDefaultDescription
textstringrequiredText to pad
lengthnumber2Target length
padStringstring” “Padding character
Examples:
{{padEnd "Price" 20 "."}}${{price}}
Output: Price...............$99.00

reverse

Reverses the characters in a string.
{{reverse "hello"}}
Output: olleh

removeSpaces

Removes all whitespace from a string.
{{removeSpaces "hello world example"}}
Output: helloworldexample Use cases:
  • Phone numbers
  • Credit card numbers (for processing)
  • Compact identifiers
{{removeSpaces "1234 5678 9012 3456"}}
<!-- Output: 1234567890123456 -->

Practical Examples

Invoice Number Formatting

INV-{{padStart year 4 "0"}}-{{padStart month 2 "0"}}-{{padStart number 6 "0"}}
<!-- Output: INV-2024-12-000042 -->

Description Preview

<p class="preview">{{truncate description 150}}</p>
<a href="/full">Read more</a>

Clean Phone Display

{{! Format: (555) 123-4567 from 5551234567 }}
({{substring phone 0 3}}) {{substring phone 3 6}}-{{substring phone 6 10}}

Text Separator

<pre>
{{repeat "=" 60}}
  {{padEnd "Item" 30}}{{padStart "Amount" 25}}
{{repeat "=" 60}}
</pre>