我现在想分析自己的聊天记录,  string txtpath = "C:\\Documents and Settings\\Administrator\\桌面\\666666.txt"; string strtxt = File.ReadAllText(txtpath, Encoding.GetEncoding("GB2312"));1.怎么把字符串按照相关的属性转化成数组并输出。2.要多线程。因为文本比较大,可能会很慢。

解决方案 »

  1.   

    首先得要看到你的聊天记录里面是怎么个记录,然后才能有针对的方法转化成数组并输出
    常用的方法都是用string.split()
    你可以查一下MSDN
      

  2.   

     
    string   txtpath   =   "C:\\Documents   and   Settings\\Administrator\\桌面\\666666.txt";   string   strtxt   =   File.ReadAllText(txtpath,   Encoding.GetEncoding("GB2312")); List<string> k = new List<string>();
                foreach (System.Text.RegularExpressions.Match vMatch in
                    System.Text.RegularExpressions.Regex.Matches(strtxt, @"2008-01-29 (.*?)(\r\n|$)"))
                {
                    k.Add(vMatch.Result("$1"));
                    Console.WriteLine(vMatch.Result("$1"));            }
                Console.WriteLine("ok!");
                Console.WriteLine(k.Count.ToString());
                Console.ReadLine();内容不见了。郁闷