use String.charAt instead of String[index]