duanliaolan6178 2018-04-02 11:39
浏览 1306
已采纳

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条回答 默认 最新

  • 普通网友 2018-04-02 11:42
    关注

    The Solution is

    sentence := fmt.Sprintf("My Name is %s", name)
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?