C++ 字符串大小写转换:将小写字母转换为大写字母
#include
int main() { string str = 'kedaoi.cn'; for (int i = 0; i < str.length(); i++) { if (str[i] >= 'a' && str[i] <= 'z') { str[i] = str[i] - 'a' + 'A'; } } cout << str << endl; return 0; }
原文地址: https://www.cveoy.top/t/topic/DIa 著作权归作者所有。请勿转载和采集!