在golang中将html字符串呈现为普通字符串

时间:2017-02-22 17:08:52

标签: go

这是我的字符串:

test1 = `<iframe src="https:\/\/www.disnei.com\/embed\/44bc40f3bc04f65b7a35" frameborder="0" width="560" height="340" scrolling="no" allowfullscreen><\/iframe>`

我希望有正常的' string as:

<iframe src="https://www.disnei.com/embed/44bc40f3bc04f65b7a35"
等等......

在golang中有一种简单的方法吗?

编辑: 以下是我的一些测试:https://play.golang.org/p/OuzNrTXYRB 我还有黑色瘟疫

感谢和问候

1 个答案:

答案 0 :(得分:2)

你可以使用go html lib中的UnescapeStringhttps://godoc.org/html#UnescapeString

相关问题