现在的位置: 首页 > 综合 > 正文

统计文本的行数

2013年10月22日 ⁄ 综合 ⁄ 共 803字 ⁄ 字号 评论关闭

            //=========================================
            //统计文本的行数
            //string s = TxtMessage.Text.Trim();
            //s = s.Replace("/r/n", "/n");
            //int j = 0;
            //s = FileRowText(2, ref j);
            //int i=s.Split("/n".ToCharArray()).Length;
            //=========================================

 

        //private string FileRowText(int i, ref int j)
        //{
        //    string path = Application.StartupPath.ToString() + "//info//1.text";
        //    StreamReader sr = File.OpenText(path);
        //    string str = "";
        //    string text = "";
        //    int num = 0;
        //    while ((str = sr.ReadLine()) != null)
        //    {
        //        num++;
        //        if (num == i)
        //        {
        //            text = str;
        //        }
        //    }
        //    j = num;
        //    return text;
        //}  

抱歉!评论已关闭.