#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);
std:string 用法
原创
©著作权归作者所有:来自51CTO博客作者ahuoheng的原创作品,请联系作者获取转载授权,否则将追究法律责任
上一篇:C++的辅助工具介绍
下一篇:vc 获得和设置系统环境变量

提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
用std::string::compare()用法
c++系列文章目录c++处理文本相对于python等脚本语言还是挺麻烦的,往往需
c++ 开发语言 后端 string.compare 字符串 -
string.find()与string::npos
是一个字符或字符串查找函数,该函数有唯一的返回类型,即string::size_type,即一个无符号
c++ java 开发语言 字符串 无符号整数 -
yarn AM无法申请到资源
Yarn 资源调度框架 实现对资源的细粒度封装(cpu,内存,带宽) 此外,还可以通过yarn协调多种不同计算框架(MR,Spark) 概述 Apache Hadoop YARN (Yet Another Resour
yarn AM无法申请到资源 Hadoop 应用程序 JVM