Use String.indexOf(char) when checking for the index of a single character; it executes faster.