This is not the proper logic ..
please think differently..
insted of checking char with the string ..
make that string to char array and then check each char.
make use of toCharArray().