I have a array of data:
!
A
B
E
$
N
I'd like it to be sorted from Alphanumeric to Non-Alphanumeric.
Example: A B E N ! $
How would I go about accomplishing this?
char[] yourOriginalValues = new [] { '!', 'A', 'B', 'E', '$', 'N' };
IEnumerable<char> result =
yourOriginalValues.Where(c => Char.IsLetterOrDigit(c))
.OrderBy(c => c)
.Concat(yourOriginalValues.Where(c => !Char.IsLetterOrDigit(c)));
That seems to yield the values you're looking for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With