duanliaolan6178
2018-04-02 11:39 阅读 513
已采纳

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

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    dongzhong5182163 dongzhong5182163 2018-04-02 11:42

    The Solution is

    sentence := fmt.Sprintf("My Name is %s", name)
    
    点赞 评论 复制链接分享

相关推荐