注册 登录
编程论坛 ASP.NET技术论坛

搜索关键字变颜色?

liaohongchu 发布于 2010-05-08 12:08, 833 次点击
string Rekeyword = "<span class=\"c_f25c00 bold\">" + Keyword + "</span>";
string stdname = cleanStr(stands.StdEnName, Keyword, Rekeyword);
            _standsname.Text = stdname;
            
 //字符串替换,str:内容,keyword:被替换的文字, Rekeyword:替换的文字
    public string cleanStr(string str, string keyword, string Rekeyword)
    {
        StringBuilder bs = new StringBuilder(str);
        //bs = bs.Replace("<", "&lt;");
        //bs = bs.Replace(">", "&gt;");
        bs = bs.Replace(keyword, Rekeyword);
 
        return bs.ToString();
    }

din iso 965 搜索这个  颜色 都没有变的

搜索965 颜色就有了  为什么呢 ?错哪里了?
2 回复
#2
yms1232010-05-08 18:28
多关键字搜索变颜色?楼主这个代码是只能单关键字的,多关键字要循环替换。
#3
liaohongchu2010-05-14 00:16
不是多个关键字。 new work 有个空格的 就不行了  是 都一起的
1