1. <tfoot id='gnjEs'></tfoot>
      • <bdo id='gnjEs'></bdo><ul id='gnjEs'></ul>

      1. <i id='gnjEs'><tr id='gnjEs'><dt id='gnjEs'><q id='gnjEs'><span id='gnjEs'><b id='gnjEs'><form id='gnjEs'><ins id='gnjEs'></ins><ul id='gnjEs'></ul><sub id='gnjEs'></sub></form><legend id='gnjEs'></legend><bdo id='gnjEs'><pre id='gnjEs'><center id='gnjEs'></center></pre></bdo></b><th id='gnjEs'></th></span></q></dt></tr></i><div id='gnjEs'><tfoot id='gnjEs'></tfoot><dl id='gnjEs'><fieldset id='gnjEs'></fieldset></dl></div>
        <legend id='gnjEs'><style id='gnjEs'><dir id='gnjEs'><q id='gnjEs'></q></dir></style></legend>

        <small id='gnjEs'></small><noframes id='gnjEs'>

        从电子邮件的字符串正文中删除格式标记

        Remove formatting tags from string body of email(从电子邮件的字符串正文中删除格式标记)

          <tfoot id='TpUyL'></tfoot>
          <i id='TpUyL'><tr id='TpUyL'><dt id='TpUyL'><q id='TpUyL'><span id='TpUyL'><b id='TpUyL'><form id='TpUyL'><ins id='TpUyL'></ins><ul id='TpUyL'></ul><sub id='TpUyL'></sub></form><legend id='TpUyL'></legend><bdo id='TpUyL'><pre id='TpUyL'><center id='TpUyL'></center></pre></bdo></b><th id='TpUyL'></th></span></q></dt></tr></i><div id='TpUyL'><tfoot id='TpUyL'></tfoot><dl id='TpUyL'><fieldset id='TpUyL'></fieldset></dl></div>

          • <bdo id='TpUyL'></bdo><ul id='TpUyL'></ul>

              <small id='TpUyL'></small><noframes id='TpUyL'>

                  <legend id='TpUyL'><style id='TpUyL'><dir id='TpUyL'><q id='TpUyL'></q></dir></style></legend>
                    <tbody id='TpUyL'></tbody>
                1. 本文介绍了从电子邮件的字符串正文中删除格式标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  调用时如何去掉所有格式化标签:

                  How do you remove all formatting tags when calling:

                  GmailApp.getInboxThreads()[0].getMessages()[0].getBody()
                  

                  使得文本的唯一剩余部分是可以阅读的.

                  such that the only remainder of text is that which can be read.

                  格式化可以被破坏;正文中的文本只需要解析即可,但标签如:

                  Formatting can be destroyed; the text in the body is only needed to be parsed, but tags such as:

                  "&amp;" 
                  <br>
                  

                  可能还有其他人,需要删除.

                  and possibly others, need to be removed.

                  推荐答案

                  我不确定您所说的 .getBody() 是什么意思 - 这应该返回一个 DOM 正文元素吗?

                  I am not sure what you mean by .getBody() - is this supposed to return a DOM body element?

                  然而,去除 HTML 标签最简单的解决方案可能是让浏览器渲染 HTML 并询问他的文本内容:

                  However, the simplest solution for removing HTML tags is probably to let the browser render the HTML and ask him for the text content:

                  var myHTMLContent = "hello &amp; world <br />!";
                  var tempDiv = document.createElement('div');
                  tempDiv.innerHTML = myHTMLContent;
                  
                  // retrieve the cleaned content:
                  var textContent = tempDiv.innerText;
                  

                  对于上面的例子,textContent 变量将包含文本

                  With the above example, the textContent variable will contain the text

                  "hello & world
                  !"
                  

                  (请注意由于 <br/> 标签引起的换行符.)

                  (Note the line break due to the <br /> tag.)

                  这篇关于从电子邮件的字符串正文中删除格式标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  quot;Status Code:200 OK (from ServiceWorker)quot; in Chrome Network DevTools?(“状态码:200 OK(来自 ServiceWorker)在 Chrome 网络开发工具中?)
                  How to set a header for a HTTP GET request, and trigger file download?(如何为 HTTP GET 请求设置标头并触发文件下载?)
                  Adding custom HTTP headers using JavaScript(使用 JavaScript 添加自定义 HTTP 标头)
                  What is quot;X-Content-Type-Options=nosniffquot;?(什么是“X-Content-Type-Options=nosniff?)
                  SQL Query DocumentDB in Azure Functions by an integer not working(通过整数在 Azure Functions 中 SQL 查询 DocumentDB 不起作用)
                  Azure Functions [JavaScript / Node.js] - HTTP call, good practices(Azure Functions [JavaScript/Node.js] - HTTP 调用,良好实践)

                      1. <tfoot id='Mxgla'></tfoot>
                        <legend id='Mxgla'><style id='Mxgla'><dir id='Mxgla'><q id='Mxgla'></q></dir></style></legend>
                      2. <small id='Mxgla'></small><noframes id='Mxgla'>

                          <bdo id='Mxgla'></bdo><ul id='Mxgla'></ul>

                              <tbody id='Mxgla'></tbody>

                            <i id='Mxgla'><tr id='Mxgla'><dt id='Mxgla'><q id='Mxgla'><span id='Mxgla'><b id='Mxgla'><form id='Mxgla'><ins id='Mxgla'></ins><ul id='Mxgla'></ul><sub id='Mxgla'></sub></form><legend id='Mxgla'></legend><bdo id='Mxgla'><pre id='Mxgla'><center id='Mxgla'></center></pre></bdo></b><th id='Mxgla'></th></span></q></dt></tr></i><div id='Mxgla'><tfoot id='Mxgla'></tfoot><dl id='Mxgla'><fieldset id='Mxgla'></fieldset></dl></div>