Library string Type-标准库中的string类型

注意
For historical reasons,and for compatibility with C, character string literals are not the same type as the standard library string type. The fact can cause confusion and is important to keep in mind when using a string literal or the string data type.

       由于一些历史原因,为了与C语言兼容,字符串字面值(character string literals)与标准库中的字符串类型(string type)是不同的类型。当我们使用一个字符串值或者字符串数据类型时会产生困扰,必须牢记它们的区别。

1 Library string Type

#include<string>
using std::string;
1.1 Defining and Initializing strings
Table Ways to Initialize a string
string s1;
string s2(s1)
1.2 Reading and Writing strings

Reading an Unknow Number of strings
Using getline to Read an Entire Line

1.3 Operations on strings

The string size and empty Operations
string::size_type
The string Relational Operators
Assignment for strings
Adding Two strings
Adding Character String Literals and strings
Fetching a Character from a string
Subscripting Yields an Lvalue
Computing Subscript Values

1.4 Dealing with the Characters of a string
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值