如何按字母排序字符串数组? [英] how to sort a string array by alphabet?
本文介绍了如何按字母排序字符串数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有很多字符串组成的数组.如何按字母对字符串排序?
I've got a array of many strings. How can I sort the strings by alphabet?
推荐答案
Sounds like you just want to use the Array.Sort
method.
Array.Sort(myArray)
有很多重载,有些重载使用自定义比较器(类或委托),但是默认重载应按您希望的那样按字母顺序(升序)进行排序.
There are many overloads, some which take custom comparers (classes or delegates), but the default one should do the sorting alphabetically (ascending) as you seem to want.
这篇关于如何按字母排序字符串数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文