Here\'s what I have:
char[] charArray = new char[] {\'h\',\'e\',\'l\',\'l\',\'o\'};
I want to write something to the effect of:
<
From NumberKeyListener source code. This method they use to check if char is contained in defined array of accepted characters:
protected static boolean ok(char[] accept, char c) {
for (int i = accept.length - 1; i >= 0; i--) {
if (accept[i] == c) {
return true;
}
}
return false;
}
It is similar to @ÓscarLópez solution. Might be a bit faster cause of absence of foreach iterator.