#include "stdafx.h"
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
printf("Hello World!\n");
string s1="hello world!";
printf("s1.find('o')=%d \n",s1.find('o'));
printf("s1.find('o',5)=%d \n",s1.find('o',5));
printf("%s\n",s1.append("Good!").c_str());
printf("%s \n",s1.substr(2,5).c_str());
return 0;
}
Hello World!
s1.find('o')=4
s1.find('o',5)=7
hello world!Good!
llo w
#include <cctype>
#include <algorithm>
//大小写转换
string s = "Clare";
// toUpper
transform(s.begin(), s.end(), s.begin(), toupper);
// toLower
//transform(s.begin(),s.end(),s.begin(),tolower);