String[] a = new String[] { "NIKE", "한글","adidas","한글Korean" };
I like to order the array, the 한글
is first
if I just order without options. the English String is always on top.
how can I do this?
and sorry about my horroble Enligsh,
String[] a = new String[] { "NIKE", "한글","adidas","한글Korean" };
I like to order the array, the 한글
is first
if I just order without options. the English String is always on top.
how can I do this?
and sorry about my horroble Enligsh,
An overload of OrderBy
takes an IComparer<string>
and you can get one of these for a specific culture using the static Create
method on StringComparer
. Something like this should work:
CultureInfo ci = CultureInfo.GetCultureInfo("ko-KR");
bool ignoreCase = true; //whether comparison should be case-sensitive
StringComparer comp = StringComparer.Create(ci, ignoreCase);
string[] unordered = //whatever
var ordered = unordered.OrderBy(s => s, comp);