Skip to content

Instantly share code, notes, and snippets.

@bootleg224
Last active May 6, 2022 18:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bootleg224/9cd4f0b719ee63ffb32f2400901646af to your computer and use it in GitHub Desktop.
Save bootleg224/9cd4f0b719ee63ffb32f2400901646af to your computer and use it in GitHub Desktop.
{{!contains can checks if one string is within another}}
{{#contains submissionForm.title "Bread"}}
Contains Bread
{{else}}
Does not
{{/contains}}
<hr/>
{{!default shows the first non-empty string}}
First Empty String: {{default "" "" "2" "1"}}<br/>
First Empty Menu Item: {{default submissionForm.favoriteMenuItems.[2].fieldValues.menuItem submissionForm.favoriteMenuItems.[1].fieldValues.menuItem submissionForm.favoriteMenuItems.[0].fieldValues.menuItem "None"}}
<hr/>
{{!split can segment a string by a character}}
{{#split submissionForm.title " "}} {{!split title by [space]}}
- Split Count: {{length this}}<br/> {{!number of records}}
- First: {{first this}}<br/>
- Last: {{last this}}<br/>
- Item at Array Index 1: {{itemAt this "1"}}
{{/split}}
<hr/>
Sample Text: {{submissionForm.quickReview10WordsOrLess}}<br/>
capitalize: {{capitalize submissionForm.quickReview10WordsOrLess}}<br/>
capitalizeAll: {{capitalizeAll submissionForm.quickReview10WordsOrLess}}<br/>
uppercase: {{uppercase submissionForm.quickReview10WordsOrLess}}<br/>
lowercase: {{lowercase submissionForm.quickReview10WordsOrLess}}<br/>
capitalize after lowercase: {{capitalize (lowercase submissionForm.quickReview10WordsOrLess)}}<br/>
capitalizeAll after lowercase: {{capitalizeAll (lowercase submissionForm.quickReview10WordsOrLess)}}<br/>
<hr/>
String 1: {{submissionForm.title}}<br/>
String 2: {{submissionForm.favoriteMenuItems.[0].fieldValues.menuItem}}<br/>
append: {{append submissionForm.title submissionForm.favoriteMenuItems.[0].fieldValues.menuItem}}<br/>
prepend: {{prepend submissionForm.title submissionForm.favoriteMenuItems.[0].fieldValues.menuItem}}<br/>
reverse (string 1): {{reverse submissionForm.title}}<br/>
ellipsis (4 chars): {{ellipsis submissionForm.title 4}}<br/>
truncate (4 chars with !): {{truncate submissionForm.title 4 "!"}}<br/>
occurences of a: {{occurrences submissionForm.title "a"}}<br/> {{!note this can be a string not just a single character}}
remove a: {{remove submissionForm.title "a"}}<br/> {{!note this can be a string not just a single character}}
removeFirst a: {{removeFirst submissionForm.title "a"}}<br/> {{!note this can be a string not just a single character}}
replace a: {{replace submissionForm.title "a" "_"}}<br/> {{!note this can be a string not just a single character}}
replaceFirst a: {{replaceFirst submissionForm.title "a" "_"}}<br/> {{!note this can be a string not just a single character}}
trim (remove whitespace): {{trim submissionForm.title}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment