怎样用C#来进行字符串数组的自然排序
发布网友
发布时间:2023-06-21 20:12
我来回答
共1个回答
热心网友
时间:2024-02-27 14:29
string[] s = { "a", "A", "ab", "aB", "Ab", "AB", "b", "B" };
Array.Sort(s, (a, b) => string.Compare(a, b, StringComparison.Ordinal));
排序后
{"A","AB","Ab","B","a","aB","ab","b"}