太简单了,把你上面那串东西当作一个字符串写进111这个文件中就行了

不相信未作牺牲竟先可拥有,只相信靠双手找到我的欲求!!
我的博客:http://liao5930.blog.

2008-09-19 15:45
2008-09-19 15:59
2008-09-21 10:01
2008-09-22 14:53
2008-09-22 15:47
LZ 很强 。。。
2008-09-23 09:14
2008-09-23 09:27

2008-09-24 16:49
2008-09-27 09:54
程序代码: StreamReader sr = File.OpenText(@"c:\log\1.txt");
StreamWriter sw = File.CreateText(@"c:\log\2.txt");
int[] num = new int[255];
string[] str = new string[255];
int positon = 0;
string line,temp,pre;
line = sr.ReadLine().TrimEnd();
while(line != null && line.Length > 5){
//MessageBox.Show(line.LastIndexOf(" ")+ " " + line.Length);
temp = line.Substring(line.LastIndexOf(" ")+1,line.Length-line.LastIndexOf(" ")-1);
str[positon] = line.Substring(0,line.LastIndexOf(" "));
num[positon] = Convert.ToInt32(temp);
if(positon!=0 && num[positon]!= num[positon-1])
{
pre = "";
for (int i =0;i< num[positon-1].ToString().Length;i++)
pre += " ";
sw.WriteLine(str[0] + pre + "1");
for (int i =1;i< positon-1;i++)
sw.WriteLine(str[i] + pre + "2");
sw.WriteLine(str[positon-1] + pre + "3");
num = new int[255];
str = new string[255];
str[0] = line.Substring(0,line.LastIndexOf(" "));
num[0] = Convert.ToInt32(temp);
positon = 0;
}
line = sr.ReadLine();
if (line != null)
line = line.TrimEnd();
positon++;
}
pre = "";
for (int i =0;i< num[positon-1].ToString().Length;i++)
pre += " ";
sw.WriteLine(str[0] + pre + "1");
for (int i =1;i< positon-1;i++)
sw.WriteLine(str[i] + pre + "2");
sw.WriteLine(str[positon-1] + pre + "3");
sr.Close();
sw.Close();

2008-09-27 10:46