日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學(xué)無(wú)先后,達(dá)者為師

網(wǎng)站首頁(yè) 編程語(yǔ)言 正文

批處理從html格式(接收到的郵件)中讀取數(shù)據(jù)的操作方法_DOS/BAT

作者:列兵 ? 更新時(shí)間: 2023-02-10 編程語(yǔ)言

通過(guò)第三方批處理getmail可以獲取到郵箱里的郵件。獲取后經(jīng)其自身解碼,得到一個(gè)Extract*.out文件,大致看一下其格式應(yīng)該為html的寫法,并且內(nèi)容只分一行。

<div dir="auto">here is the content</div>

顯然我郵件發(fā)送的原內(nèi)容為:

here is the content

現(xiàn)在要提取出其中的原內(nèi)容并且將所有內(nèi)容合并到一行。問(wèn)題在于,郵箱不一定每次都接收到這樣簡(jiǎn)單的文件。例如內(nèi)容當(dāng)中出現(xiàn)換行:

<div dir="auto">abababababababab<br /><br />abababababababab<br /><br /></div>

有時(shí)內(nèi)容含特殊字符,解碼之后也無(wú)法正常顯示(某些字符):

i wanna get these words # $ % & * @ ? !
<div dir="auto">i wanna get these words # $ % &amp; * &#64; ? !</div>

有時(shí)發(fā)送的內(nèi)容經(jīng)過(guò)復(fù)制粘貼,不小心留下了其他信息:

<div dir="auto">hey get it <span style="font-family:sans-serif">hey get it </span><br style="font-family:sans-serif" /><span style="font-family:sans-serif">hey get it </span><span style="font-family:sans-serif">hey get it </span><br style="font-family:sans-serif" /></div>

顯然需要忽略<>標(biāo)簽里的所有內(nèi)容才能得到原內(nèi)容,并且需要還原未正常顯示的符號(hào)。
可能要用到第三方了……

原文鏈接:http://www.bathome.net/viewthread.php?from=notice&tid=64776

欄目分類
最近更新