Toggle menu

Strings

Manipulate strings. Includes "lowercase", "uppercase", "capitalizeFirst", "titleize", "sentence", "reverse", "truncate", "center", "newLineToBr" and "sanitize".

lowercase

Turns a string to lowercase.

Parameters

None.

Example

{{lowercase "BENDER SHOULD NOT BE ALLOWED ON TV"}}

Result

bender should not be allowed on tv

uppercase

Turns a string to uppercase.

Parameters

None

Example

{{uppercase "bender should not be allowed on tv"}}

Result

BENDER SHOULD NOT BE ALLOWED ON TV

capitalizeFirst

Capitalizes the firs word in a string.

Parameters

None.

Example

{{capitalizeFirst "bender should not be allowed on TV"}}

result

Bender should not be allowed on TV

capitalizeEach

Capitalizes each word in a string.

Parameters

None

Example

{{capitalizeEach "bender should NOT be allowed on TV"}}

Result

Bender Should NOT Be Allowed On TV

titleize

Capitalizes all words within a string.

Parameters

None

Example

{{titleize "Bender-should-Not-be-allowed_on_Tv."}}

Result

Bender Should Not Be Allowed On Tv.

sentence

Capitalizes the first word of each sentence in a string and converts the rest of the sentence to lowercase.

Parameters

None.

Example

{{sentence "bender should NOT be allowed on TV. fry SHOULD be allowed on TV."}}

Result

Bender should not be allowed on tv. Fry should be allowed on tv.

reverse

Reverses a string.

Parameters

None

Example

{{reverse "bender should NOT be allowed on TV."}}

Result

.VT no dewolla eb TON dluohs redneb

truncate

Truncates a string given a specified length, providing a custom string to denote an omission.

Parameters

length [int] - The number of characters to keep (Required)

omission [string] - A string to denote an omission (Optional)

Example

{{truncate "Bender should not be allowed on tv." 31 "..."}}

Result

Bender should not be allowed...

center

Puts the specified number of non-breaking spaces either side of a string.

Parameters

paces [int] - The number of spaces. (Required)

Example

{{center "Bender should not be allowed on tv." 10}}

Result

Bender should not be allowed on tv.

newLineToBr

Converts new line characters \n to line breaks <br>.

Parameters

None

Example

{{{newLineToBr "Bender \n should \n not \n be allowed on tv."}}}

Result

Bender <br>
should <br>
not <br>
be allowed on tv.

sanitize

Sanitizes strings for safe use in URLs and file names.

Parameters

replacement [string] - A replacement character (Optional)

Example

{{{sanitize "Sex & The City 2" "-"}}}

Result

Sex---The-City-2

Last modified on 6 September 2023

Share this page

Facebook icon Twitter icon email icon

Print

print icon