Right now I'm doing
for (char c = 'a'; c <= 'z'; c++) { alphabet[c - 'a'] = c; }
but is there a better way to do it? Similar to Scala's 'a' to 'z'
'a' to 'z'
I think that this ends up a little cleaner, you don't have to deal with the subtraction and indexing:
char[] alphabet = "abcdefghijklmnopqrstuvwxyz".toCharArray();
1.4m articles
1.4m replys
5 comments
56.9k users