Standard library / text/template

text/template.Template.Delims()

Changes the action delimiters for subsequent parses. Expected stdout: 'Hello Ada\n'.

Formal Syntax & Structure

go syntaxgo
func (t *Template) Delims(left, right string) *Template

Parameters & Attributes

NameTypeDescription
leftstringLeft action delimiter.
rightstringRight action delimiter.

Return Value

*Template

Changes the action delimiters for subsequent parses.

Working Example

Example Snippetgo
package main
import (  "fmt"  "os"  "text/template")
func check(e error) {  if e != nil {    panic(e)  }}
func main() {  t := template.Must(template.New("greet").Delims("[[", "]]").Parse("Hello [[.]]"))  check(t.Execute(os.Stdout, "Ada"))  fmt.Println()}
Go Reference