toLower toUpper
1.根据二进制规律很容易就发现
char toLower(char x) { if (x >= 'A' && x <= 'Z')return (x | 0x20); return x; } char toUpper(char x) { if (x >= 'a' && x <= 'z')return (x & 0xDF); return x; }
2. 根据ASCII 规律
char toLower(char x) { if (x >= 'A' && x <= 'Z')return (x+ 'a'-'A'); return x; } char toUpper(char x) { if (x >= 'a' && x <= 'z')return (x - 'a' + 'A'); return x; }