String Helpers API reference for string manipulation template helpers type Guide

String Helpers

String helpers provide utilities for manipulating and formatting strings in templates.

Functions

stringify

Converts a value to JSON string.

Template Syntax

{stringify objectToStringify}

Parameters

NameTypeDescription
aanyThe value to stringify

Returns

string - JSON string representation of the input.

Example

<pre>{stringify user}</pre>

concat

Concatenates all arguments.

Template Syntax

{concat firstName ' ' lastName}

Parameters

NameTypeDescription
args…anyValues to concatenate

Returns

string - Concatenated string of all arguments.

Example

<h1>Welcome, {concat user.firstName ' ' user.lastName}!</h1>

capitalize

Capitalizes the first letter of text.

Template Syntax

{capitalize textToCapitalize}

Parameters

NameTypeDescription
textstringThe text to capitalize

Returns

string - The input text with the first letter capitalized.

Example

<p>{capitalize pageTitle}</p>

titleCase

Converts text to title case.

Template Syntax

{titleCase textToTitleCase}

Parameters

NameTypeDescription
textstringThe text to convert

Returns

string - The input text converted to title case.

Example

<h2>{titleCase article.title}</h2>

tokenize

Tokenizes a string.

Template Syntax

{tokenize stringToTokenize}

Parameters

NameTypeDescription
stringstringThe string to tokenize

Returns

string - The tokenized string.

Example

<div id="{tokenize sectionTitle}">
<h3>{sectionTitle}</h3>
</div>

escapeHTML

Escapes HTML special characters in a string.

Template Syntax

{escapeHTML stringToEscape}

Parameters

NameTypeDescription
stringstringThe string to escape

Returns

string - The input string with HTML special characters escaped.

Example

<div title="{escapeHTML userInput}">
{userInput}
</div>
<h3>User Bio</h3>
<p>
{#html escapeHTML bioHTML}
</p>