dsbm49845 2017-06-01 18:57
浏览 31
已采纳

在Golang中将Int *转换为String

I need to get the string value of pointer, how can I achieve it?

Something like &a.String()

  • 写回答

1条回答 默认 最新

  • douzi9430 2017-06-01 19:05
    关注

    Use fmt.Sprintf():

    func main() {
        i := 42
        ip := &i
        strValue := fmt.Sprintf("%p", &ip)
        fmt.Println(strValue)
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?