如题,实在没有C#的,C的也可以
最好有注释~

解决方案 »

  1.   

    支持伟大的viena(维也纳nn-下潜15米,潜望镜升起) MM..呵呵..
      

  2.   

    正则表达式?
    string yourStr = ......;//这个页面Ctrl+A,Ctrl+C
    Regex regex = new Regex("跪求|维也纳", RegexOptions.IgnoreCase);
    MatchCollection mc = regex.Matches(yourStr);
    Dictionary<string, int> key = new Dictionary<string, int>;
    key.Add("跪求", 0);
    key.Add("维也纳", 0);
    foreach(Match m in mc)
    {
        if(m.Value == "跪求")
        {
            key["跪求"]++;
        }
        else
        {
            key["维也纳"]++;
        }
    }
      

  3.   

    Lucene .NET 不知道对老大有没有帮助!
      

  4.   

    要把找到的关键字替换为指定的值
    要求高执行效率,C#可能要用Unsafe代码
      

  5.   

    viena(维也纳nn-下潜15米,潜望镜升起) MM,我已经尽力,想千方,设百计,结果还是没能找着..帮MM顶哦..如果找不着就看算法写个呗,对你来说应该也不难..
      

  6.   

    这些应该可以
    C#,VB.NET的都有
    http://dotnetjunkies.com/Tutorial/195E323C-78F3-4884-A5AA-3A1081AC3B35.dcik
      

  7.   

    andhttp://www.codeproject.com/csharp/highlightcs.asp?df=100&forumid=14824&exp=0&select=1760087
      

  8.   

    while(i&lt;=lengthRes &amp;&amp;j&lt;=lengthStr) { if(res[i]==str[j]) { // go on matching ++i;} else if( j == lengthStr ) return i-lengthStr;起存在和串 T 相同的子串,则称匹配成功,返回第一个。这样的子串在串 S 中的下标,否则返回 -1 */ int i = pos, j = 0; while ( res[i+j] != ’\0’&amp;&amp; str[j] != ’\0’)// 匹配成功 返回下标 else return -1; // 串S中(第pos个字符起)不存在和串T相同的子串}
      

  9.   

    /*
    sm.cs &copy; 2007 by Shuiwatermizu
    1. scan the original string from the start.
    2. look for all the string in lookfor array.
    if found, scan the original string from the position after the found string
    if not found, scan the next character of the original string

    This method is faster than regex.
    */
    using System;
    using System.Diagnostics;public class T
    { public static void Main()
    {
    string original=@"onetwothreefour";
    string[] lookfor=new string[]{"two", "four"};
    string[] replacewith=new string[]{"twenty", "forty"};
    Console.WriteLine("After replace: {0}", ReplaceEx2(original, lookfor, replacewith));
    }//end of Main() public static string ReplaceEx2(string original, string[] lookfor, string[] replacewith)
    {
    int increasedSize=0;
    for (int t=0;t<lookfor.Length;t++)
    {
    increasedSize+=replacewith[t].Length-lookfor[t].Length;
    }
    int retLen=original.Length+increasedSize;//Adjust this value to accomodate the result string.

    char[] ret=new char[retLen];

    int i=0; //position of the original string
    int j=0; //position of the result.
    int m=0;
    while (i<original.Length)
    {
    for (m=0;m<lookfor.Length;m++)//loop through all the search strings
    {
    int n=0;
    while (n<lookfor[m].Length)//loop through a single search string
    {
    if (i+n<original.Length)
    {
    if (lookfor[m][n]!=original[i+n])
    break;//not found
    }
    else
    break;
    n++;
    }

    if (n==lookfor[m].Length)//found match of lookfor[m]
    {
    Console.WriteLine("match {0} at position {1}", lookfor[m], i);//DoFoundOperation();
    for (int k=0;k<replacewith[m].Length;k++)
    ret[j+k]=replacewith[m][k];
    j+=replacewith[m].Length;
    i+=lookfor[m].Length;
    break;
    }
    }

    if (m==lookfor.Length)//not match all the search string
    {
    ret[j]=original[i];
    j++;
    i++;
    }
    }//loop through the total string.
    return (new string(ret));
    }
    }
      

  10.   

    SQL配置 全文索引 用 喂词 查询
    不行、?
      

  11.   

    c++primer 6章 里面有 类似 算法
      

  12.   

    TO:楼主是MM????嗯,是的..
      

  13.   

    liujia_0421(SnowLover) ( ) 信誉:100    Blog  2007-01-16 12:29:03  得分: 0  
     
     
       TO:楼主是MM????嗯,是的..
      
     
    Top  
     viena(维也纳nn-下潜15米,潜望镜升起) ( ) 信誉:100    Blog  2007-01-16 12:51:10  得分: 0  
     
     
       我不是MM,楼上是我女朋友~
      
     
    Top  
     liujia_0421(SnowLover) ( ) 信誉:100    Blog  2007-01-16 12:59:18  得分: 0  
     
     
       ^_^
      
     
    Top  
    ============================
    TQ贴~~