utility to find the next character in a string