当前位置:网站首页>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)
边栏推荐
- [One step in place] Jenkins installation, deployment, startup (complete tutorial)
- Gartner 权威预测未来4年网络安全的8大发展趋势
- 使用Loadrunner进行性能测试
- What is the salary of a software testing student?
- 5个开源组件管理小技巧
- C专家编程 第5章 对链接的思考 5.6 轻松一下---看看谁在说话:挑战Turning测验
- 在被面试官说了无数次后,终于潜下心来整理了一下JVM的类加载器
- [SemiDrive source code analysis] [MailBox inter-core communication] 47 - Analysis of RPMSG_IPCC_RPC mode limit size of single transmission and limit bandwidth test
- Can 't connect to MySQL server on' localhost3306 '(10061) simple solutions
- Landing, the IFC, GFC, FFC concept, layout rules, forming method, use is analysed
猜你喜欢

Delphi-C端有趣的菜单操作界面设计

word 公式编辑器 键入技巧 | 写数学作业必备速查表

MySQL log articles, binlog log of MySQL log, detailed explanation of binlog log

Can 't connect to MySQL server on' localhost3306 '(10061) simple solutions

败给“MySQL”的第60天,我重振旗鼓,四面拿下蚂蚁金服offer

【论文阅读笔记】无监督行人重识别中的采样策略

编程大杂烩(三)
![[Cloud Native--Kubernetes] Pod Resource Management and Probe Detection](/img/1a/b3bdf9b62c82b0fc4d913045981d94.png)
[Cloud Native--Kubernetes] Pod Resource Management and Probe Detection

MySQL database (basic)

el-Select selector bottom fixed
随机推荐
触觉智能分享-SSD20X实现升级显示进度条
OpenSSF 安全计划:SBOM 将驱动软件供应链安全
Tactile intelligent sharing - SSD20X realizes upgrade display progress bar
8.03 Day34---BaseMapper查询语句用法
自动化测试的成本高效果差,那么自动化测试的意义在哪呢?
Do you think border-radius is just rounded corners?【Various angles】
C Expert Programming Chapter 4 The Shocking Fact: Arrays and pointers are not the same 4.2 Why does my code not work
C专家编程 第5章 对链接的思考 5.3 函数库链接的5个特殊秘密
CentOS7 - yum install mysql
嵌入式系统驱动初级【3】——字符设备驱动基础中_IO模型
What are the steps for how to develop a mall system APP?
12. Paging plugin
力扣:70. 爬楼梯
Can 't connect to MySQL server on' localhost3306 '(10061) simple solutions
C1认证之web基础知识及习题——我的学习笔记
Get the selected content of the radio box
应届生软件测试薪资大概多少?
擎朗智能全国研发创新中心落地光谷:去年曾获2亿美元融资
商城系统APP如何开发 都有哪些步骤
Summary of MySQL database interview questions (2022 latest version)