首页  ·  知识 ·  编程语言
收藏夹文件bookmark.htm导入,读取
佚名  http://www.cnblogs.com/idotnet8/  .NET  编辑:dezai  图片来源:网络
"FONT-SIZE: 12px; COLOR: black; FONT-FAMILY: Verdana; BACKGROUND-COLOR: transparent"> "FONT-SIZE: 12px; COLOR: blue; FONT-F

引入命名空间:using System.Text.RegularExpressions;

private
void Page_Load(object sender, System.EventArgs e)
        {
            string str = LoadFile("bookmark.htm");
            MatchCollection category = Regex.Matches(str, "

(.+?)

", RegexOptions.IgnoreCase | RegexOptions.Multiline );
            foreach(Match m in category)
            {
                this.Label1.Text+=m.Groups[0].Value;//显示分类
            }
            MatchCollection link=Regex.Matches(str,"
(.+?)", RegexOptions.IgnoreCase | RegexOptions.Multiline );
            foreach(Match n in link)
            {
                this.Label2.Text+=n.Groups[0].Value;//显示列表
            }
        }
        private string LoadFile(string file)
        {
            StringWriter sw = new StringWriter ();
             Server.Execute (file, sw);
             string content = sw.ToString ();
            return content;
        }

本文作者:佚名 来源:http://www.cnblogs.com/idotnet8/
CIO之家 www.ciozj.com 微信公众号:imciow
   
免责声明:本站转载此文章旨在分享信息,不代表对其内容的完全认同。文章来源已尽可能注明,若涉及版权问题,请及时与我们联系,我们将积极配合处理。同时,我们无法对文章内容的真实性、准确性及完整性进行完全保证,对于因文章内容而产生的任何后果,本账号不承担法律责任。转载仅出于传播目的,读者应自行对内容进行核实与判断。请谨慎参考文章信息,一切责任由读者自行承担。
延伸阅读