- tolower()/toupper():将字符串string转换大小写
- isalnum():判断字符串是否为字母+十进制数字
- isdigit():判断字符串是否为十进制数字
- islower(): 判断字符串是否为小写
- isupper(): 判断字符串是否为大写
- isalpha(): 判断字符串是否为字母
- substr(pos, len):提取字符串从pos开始的长度为len的子串
#include <iostream>
#include <string>
int main() {
std::string str = "Hello, World!";
std::string newStr = str.substr(5);
std::cout << "New string: " << newStr << std::endl;
std::string newStr2 = str.substr(6, 6);
std::cout << "New string 2: " << newStr2 << std::endl;
return 0;
}
New string: , World!
New string 2: World!