[core] Using the ctype functions for better performance.