标签:
string[] words = { "Tuesday", "Sal?", "Вторник", "Mardi", "Τρ?τη", "Martes", "??? ?????", "????????", "?????????" }; StreamWriter sw = new StreamWriter(@".\output.txt"); // Display array in unsorted order. foreach (string word in words) sw.WriteLine(word); sw.WriteLine(); // Create parallel array of words by calling ToUpperInvariant. string[] upperWords = new string[words.Length]; for (int ctr = words.GetLowerBound(0); ctr <= words.GetUpperBound(0); ctr++) upperWords[ctr] = words[ctr].ToUpperInvariant(); // Sort the words array based on the order of upperWords. Array.Sort(upperWords, words, StringComparer.InvariantCulture); // Display the sorted array. foreach (string word in words) sw.WriteLine(word); sw.Close();
ToUpperInvariant and Array.Sort
标签:
原文地址:http://www.cnblogs.com/yipeng-yu/p/4244213.html