当前位置: 代码迷 >> Delphi >> 文本本文件统计有关问题
  详细解决方案

文本本文件统计有关问题

热度:5884   发布时间:2013-02-25 00:00:00.0
文本本文件统计问题
xxx.txt 文件有(Love is like collecting shells) 
读取 xxx.txt 文件 统计文件里的有多少个单词,请问高手怎么做


 

------解决方案--------------------------------------------------------
用空格分割放到一个数组里
数组的长度就是单词的个数
------解决方案--------------------------------------------------------
C# code
 string path = "c:\\test.txt";            StreamReader sr = new StreamReader (path);            string [] s = sr.ReadLine().Split(' ');            s.Length//这就是单词个数
  相关解决方案