D
David Jackson
Hello,
I have the following code for sorting strings alphabetically:
string strRaw = "Thisisastring";
char[] astrSorted = strRaw.ToCharArray().ToArray();
Array.Sort(astrSorted);
string strSorted = String.Empty;
foreach (char strChar in astrSorted)
{
strSorted += strChar;
}
Apart from the fact that it's probably not very efficient, the problem I
have is that it sorts according to the ASCII value of each character, which
means that all the upper-case letters appear before all the lower-case
letters.
Can anyone please help me with a method to sort strings so that they would
appear as e.g. "AaBbCcDdEe" etc.
Thank you.
DJ
I have the following code for sorting strings alphabetically:
string strRaw = "Thisisastring";
char[] astrSorted = strRaw.ToCharArray().ToArray();
Array.Sort(astrSorted);
string strSorted = String.Empty;
foreach (char strChar in astrSorted)
{
strSorted += strChar;
}
Apart from the fact that it's probably not very efficient, the problem I
have is that it sorts according to the ASCII value of each character, which
means that all the upper-case letters appear before all the lower-case
letters.
Can anyone please help me with a method to sort strings so that they would
appear as e.g. "AaBbCcDdEe" etc.
Thank you.
DJ