Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get an array of all alpha characters [duplicate]

Tags:

string

c#

.net

Possible Duplicate:
A to Z list of char from Enumerable.Range

Is there an easy way to get a char[] of all alpha characters?

I know I could do something like this:

char[] alphas = new char[]{'a', 'b', 'c', 'd', ..............};

For all upper and lower case chars, but I am wondering if there is an easier (and cleaner looking) way to do this.

like image 875
Vaccano Avatar asked Nov 27 '22 17:11

Vaccano


1 Answers

Maybe something like this:

string alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char [] alphas = (alphabet + alphabet.ToLower()).ToCharArray();
like image 61
Gray Avatar answered Dec 14 '22 02:12

Gray