charCount function returns character count of a string without control codes.