String template
String template
Function
String template is used to embed variables or expressions in strings, suitable for generating prompt text, HTML fragments, SQL fragments or log content.
Syntax
name = 'BT' text = `Hello ${name}`
Usage recommendations
- Use backticks to wrap template strings.
+can be used for simple splicing. Template strings are preferred when multiple variables are included.- Parameter binding is still required when splicing SQL to avoid writing user input directly into SQL.