当前位置:网站首页>The string class introduction
The string class introduction
2022-08-04 05:35:00 【quack quack】
Introduction: The IOS/ANSI C++ standard extends the C++ library by adding the string class, so you can now use string-type variables (called objects in C++)Rather than just storing strings as character arrays, the string class is simpler to use than arrays, and also provides a way to represent groups of strings as a data type.
#To use the string class, the header file string must be included in the program, and the string class is located in the namespace std.
Use string objects in the same way as character arrays, but the class design allows the program to automatically handle the size of the string, so string objects are also safer than arrays
Assignment, splicing, adding value
You can assign values like normal variables, but arrays cannot
The string class simplifies merging of substrings. You can use the operator + to combine two string objects, and you can use the operator += to append strings toend of string object
Other operations of the string class
Determine the length of the string name.size(), the c++ string object uses the object name and the period operator to indicate which string to use
The output is the same as the character array, but the input of the whole line is somewhat different, which is expressed as getline(cin,str)
Other forms of string literals (to be added)
边栏推荐
- The idea setting recognizes the .sql file type and other file types
- Can‘t connect to MySQL server on ‘localhost3306‘ (10061) 简洁明了的解决方法
- 在被面试官说了无数次后,终于潜下心来整理了一下JVM的类加载器
- 入坑软件测试的经验与建议
- [Cocos 3.5.2]开启模型合批
- Redis common interview questions
- Resolved error: npm WARN config global `--global`, `--local` are deprecated
- 力扣:96.不同的二叉搜索树
- 字节最爱问的智力题,你会几道?
- Will the 2023 PMP exam use the new version of the textbook?Reply is here!
猜你喜欢

canal实现mysql数据同步

SLSA 框架与软件供应链安全防护

The difference between px, em, and rem

sql server如何得到本条记录与上一条记录的差异,即变动值

自动化测试的成本高效果差,那么自动化测试的意义在哪呢?

TSF微服务治理实战系列(一)——治理蓝图

8、自定义映射resultMap
![[Cloud Native--Kubernetes] Pod Resource Management and Probe Detection](/img/1a/b3bdf9b62c82b0fc4d913045981d94.png)
[Cloud Native--Kubernetes] Pod Resource Management and Probe Detection

8.03 Day34---BaseMapper query statement usage
![[Cocos 3.5.2]开启模型合批](/img/d9/9e8f71c9a26c8052b11291fe3ba7ac.png)
[Cocos 3.5.2]开启模型合批
随机推荐
JS basics - forced type conversion (error-prone, self-use)
Uni-app 小程序 App 的广告变现之路:全屏视频广告
BFC、IFC、GFC、FFC概念理解、布局规则、形成方法、用处浅析
8.03 Day34---BaseMapper查询语句用法
力扣:343. 整数拆分
12、分页插件
4.3 基于注解的声明式事务和基于XML的声明式事务
DP4398:国产兼容替代CS4398立体声24位/192kHz音频解码芯片
渗透测试(PenTest)基础指南
腾讯136道高级岗面试题:多线程+算法+Redis+JVM
MySQL log articles, binlog log of MySQL log, detailed explanation of binlog log
7、特殊SQL的执行
Get the selected content of the radio box
Summary of MySQL database interview questions (2022 latest version)
Performance testing with Loadrunner
The Road to Ad Monetization for Uni-app Mini Program Apps: Full Screen Video Ads
一个对象引用的思考
Canal mysql data synchronization
MySQL date functions
What is the salary of a software testing student?