refactoring internal_char_casecmp