gpt4 book ai didi

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

转载 作者:IT王子 更新时间:2023-10-29 02:03:31 25 4
gpt4 key购买 nike

这是我的字符串:

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

我想将“正常”字符串设置为:

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

等...

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

编辑:这是我的一些测试:https://play.golang.org/p/OuzNrTXYRB我还有黑斜线瘟疫

感谢和问候

最佳答案

您可以使用 go html 库中的 UnescapeString: https://godoc.org/html#UnescapeString

关于go - 在 golang 中将 html 字符串呈现为普通字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42397980/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com