This article explains what the SentenceCase() function is and provide examples of how it can be used with the binding syntax in smart templates.
Prerequisites
|
What is the SentenceCase() function?
SentenceCase() is a function that converts a piece of text to sentence case, meaning that the first word is capitalized.
SentenceCase() logic
Syntax | {{SentenceCase(text)}} |
---|---|
Input | Text |
Output | Sentence case version of the text |
Sentence() function examples
Example 1
Using the SentenceCase() function to convert text to uppercase.
Binding | {{SentenceCase("this is text")}} |
---|---|
Output | "This is text" |
Example 2
Using the SentenceCase() function together with IfElse() to convert the 'Sentence' text if the 'ConvertToSentenceCheckbox' checkbox question originating from the response form is checked.
Binding | {{IfElse(Form.ConvertToSentenceCheckbox, SentenceCase(Form.Sentence), Form.Sentence)}} | |
---|---|---|
Input | Form.Sentence = "this is a sentence" | Form.Sentence = "this is a sentence" |
Condition |
Form.ConvertToSentenceCheckbox = "☑" (True) |
Form.ConvertToSentenceCheckbox = "☐" (False) |
Output | "This is a sentence" | "this is a sentence" |
Example 3
Using the SentenceCase() function together with IfElse() to convert the 'Sentence' text if the 'HeadlineType' dropdown question originating from the response form is using the option 'Sentence'.
Binding | {{IfElse(Equals(Form.HeadlineType.Name, "Sentence"), SentenceCase(Form.Sentence), Form.Sentence)}} | |
---|---|---|
Input | Form.Sentence = "this is a sentence headline" | Form.Sentence = "this is a sentence headline" |
Condition |
Form.HeadlineType.Name = "Sentence" (True) |
Form.HeadlineType.Name = "Note" (False) |
Output | "This is a sentence headline" | "this is a sentence headline" |
Comments
Article is closed for comments.