【发布时间】:2019-07-19 17:35:55
【问题描述】:
在 JavaScript 中,这个解决方案可以完成这项工作:
function strip(html)
{
var tmp = document.createElement("DIV");
tmp.innerHTML = html;
return tmp.textContent || tmp.innerText || "";
}
但据我所知,Google Apps 脚本中没有文档。是否有另一种方法可以在 Google Apps 脚本中解析和显示来自 html 的纯文本?
我尝试过使用
HtmlService.createHtmlOutput('<b>Hello, world!</b>').getContent();
但是这只是显示带有所有标签的文本。
我的期望是
的输入'<b>Hello, world!</b>'
会输出
'Hello, world!'
【问题讨论】: