今天就跟大家聊聊有關(guān)C#中怎么刪除UL LI中指定標簽里文字,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結(jié)了以下內(nèi)容,希望大家根據(jù)這篇文章可以有所收獲。
我們提供的服務(wù)有:成都網(wǎng)站建設(shè)、網(wǎng)站制作、微信公眾號開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認證、伊金霍洛ssl等。為成百上千家企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學管理、有技術(shù)的伊金霍洛網(wǎng)站制作公司
現(xiàn)在需求越來越變態(tài),但是做代碼只能盡量滿足,這里先是扣去ul和li中的超鏈接里的文字
PromptHtml = GetData.GetHTTPInfo(Config.Prompt_Url, "utf-8"); PromptHtml = PromptHtml.Replace("<ul><li>", ""); PromptHtml=PromptHtml.Replace("</li></ul>", ""); string ss = @"<a[\s\S]*?href=""([^" rel="external nofollow" "]*?)""[^>]*?>([\s\S]*?)</a>"; //這里 MatchCollection mcTable = Regex.Matches(PromptHtml, ss); foreach (Match mTable in mcTable) { if (mTable.Success) { PromptHtml = mTable.Groups[2].Value; } } resultHtml = PromptHtml;
具體的數(shù)據(jù)源如下:
復(fù)制代碼 代碼如下:
<ul><li><a href="http://localhost/tg.aspx?ID=4194" rel="external nofollow" >哪些主題基金有望爆發(fā)?</a></li></ul>
這篇是扣去ul和li中的span里面的文字:
middlebannerHtml = GetData.GetHTTPInfo(Config.Middlebanner_Url, "utf-8"); middlebannerHtml = middlebannerHtml.Replace("<ul><li>", ""); middlebannerHtml = middlebannerHtml.Replace("</li></ul>", ""); string ss = @"<span>([^<]+)</span>"; //這里 MatchCollection mcTable = Regex.Matches(middlebannerHtml, ss); foreach (Match mTable in mcTable) { if (mTable.Success) { middlebannerHtml = mTable.Groups[1].Value; } } middleContent = middlebannerHtml;
具體的數(shù)據(jù)源如下:
復(fù)制代碼 代碼如下:
<ul><li><span>3年5倍漲幅的 不只是股票哦~</span> <a href="http://localhost/tg.aspx?ID=4195" rel="external nofollow" >立即查看</a></li></ul>
看完上述內(nèi)容,你們對C#中怎么刪除UL LI中指定標簽里文字有進一步的了解嗎?如果還想了解更多知識或者相關(guān)內(nèi)容,請關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝大家的支持。
網(wǎng)站題目:C#中怎么刪除ULLI中指定標簽里文字
網(wǎng)站URL:http://aaarwkj.com/article12/ihhdgc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供靜態(tài)網(wǎng)站、定制網(wǎng)站、動態(tài)網(wǎng)站、小程序開發(fā)、網(wǎng)站導(dǎo)航、手機網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)