shorten some substring calls
replace string[i] notation with string.charAt(i)

as string[i] is not a part of es3 and not supported by all browsers