stringtemplatesgo

Template Strings in GoLang?


i've been researching for a while now but could not find anything.

For Example

var name = "tom"
sentence := "My Name is #{name}"

In JS this works with ${var} and in ruby with #{var}

So are there Template Strings in GoLang ?

Thanks for your help


Solution

  • The Solution is

    sentence := fmt.Sprintf("My Name is %s", name)