如何从最小到最大的C#获取字符串的长度

底部是txt文件中的readbyline行,单词之间用空格隔开(“”),如何从最小的字符到最大的字符?

这是我现在的样子

点击链接

link to the picture

编码

            if (System.IO.File.Exists(textFile))
            {

                using (System.IO.StreamReader file = new System.IO.StreamReader(textFile))
                {
                    int counter = 0;
                    string words; 
                    string[] line;

                    while ((words = file.ReadLine()) != null)
                    {
                        line = Regex.Split(words, " ");
                        foreach (string line_1 in line)
                        {

                            Console.WriteLine(line_1 + " " + line_1.Length);
                        }
                        Console.WriteLine(" ");
                        counter++;
                        Console.WriteLine("Line[{1}]: {0}\n", words, counter);
                    }
                    file.Close();
                    Console.WriteLine(" ");
                    Console.WriteLine("File has [{0}] Lines.", counter);
                }
            } 
评论