bool empty() const noexcept;
注:判断string对象是否为空,为空返回true

#include <iostream>
#include <string>

using namespace std;

int main()
{
string line;
string content;
cout << "enter line\n";
do{
getline(cin, line);
content += line + '\n';

}while(!line.empty());
cout << content;
}

string::empty的更多相关文章

  1. string.empty , "" , null 以及性能的比较

    一:这种结论,个人觉得仍然存疑 http://www.cnblogs.com/wangshuai901/archive/2012/05/06/2485657.html 1.null    null 关 ...

  2. String.Empty、null、“” 区别

    概念准备: 1.引用类型是将对象是实际数据保存在堆中, 将对象在堆中的地址保存在栈中. 2.值类型直接将实际数据存放在堆中,不会将对象在堆中的地址保存在栈中. 一.String.Empty和" ...

  3. string.empty和null的区别

    关于String.Empty和Null的问题是这样的,这两个都是表示空字符串,其中有一个重点是string str1= String.Empty和 string str2=null 的区别,这样定义后 ...

  4. .Net using,string.Empty初探

    前两天够哦年公司培训,讲了编码优化.现在初步总结下:(有些不大确定的就不讲了) 多次字符串拼接(特别是循环内),宜用stringBuilder.Append()方法,少用字符串+,至于string.F ...

  5. C#中NULL,"",DBNULL,String.Empty,Convert.IsDBNull()的区别

    C#中的空值的判断较麻烦,不象在VB6中那么简单,这些各种空值的判断和理解对不熟悉的人来说,可能很麻烦,现就我在使用过程中的一点体会和大家共同分享. (1)NULL null 关键字是表示不引用任何对 ...

  6. C#中String.Empty,“”,NULL的区别

    一.String.Empty String类的静态只读字段.定义如下: public static readonly string Empty; 二.“” 被赋值为“”的字符串变量,会在栈上保存一个地 ...

  7. C#中string.Empty ,"" , null 区别

    引言 String类型作为使用最频繁的类型之一,相信大家都非常熟悉,对于string赋予空值,通常有以下三种方式: String str1=null; String str2=””; String s ...

  8. C# 中 string.Empty、""、null的区别

    原文C# 中 string.Empty."".null的区别 一.string.Empty 和 "" 1.Empty是string类中的一个静态的只读字段,它是 ...

  9. C#遍历所有的Textbox控件并赋值为String.Empty

    foreach (Control control in this.Controls) { if (control.GetType().Name.Equals("TextBox")) ...

  10. 遍历页面上所有TextBox,并赋值为String.Empty

    //不含母板页 foreach (System.Web.UI.Control txtobj in this.Page.Controls)   {     if (txtobj.GetType().Na ...

随机推荐

  1. Ceph osd故障硬盘更换

    正常状态: 故障状态: 实施更换步骤: (1)关闭ceph集群数据迁移: osd硬盘故障,状态变为down.在经过mod osd down out interval 设定的时间间隔后,ceph将其标记 ...

  2. 如何在WIN7下安装虚拟机linux系统

    需要支持多个平台的IT管理员经常会遇到如何在Windows 7计算机上安装Linux的问题.幸运的是有多种方法可供选择:双系统.Linux虚拟机和U盘引导. 当需要用到Windows 7和Linux时 ...

  3. golang depth read map

    Foreword: I optimized and improved the below solution, and released it as a library here: github.com ...

  4. 记录一次MySQL进程崩溃,无法重启故障排查

    最近程序在跑着没几天,突然访问不了,查看应用进程都还在.只有数据库的进程down掉了.于是找到日志文件看到如下错误 -- :: [Note] InnoDB: Initializing buffer p ...

  5. Leetcode之广度优先搜索(BFS)专题-529. 扫雷游戏(Minesweeper)

    Leetcode之广度优先搜索(BFS)专题-529. 扫雷游戏(Minesweeper) BFS入门详解:Leetcode之广度优先搜索(BFS)专题-429. N叉树的层序遍历(N-ary Tre ...

  6. Oracle 自增序列的生成

    1.代码结构 .创建 第一种 -- Create sequence create sequence SEQ_USERID minvalue maxvalue start increment nocac ...

  7. 【Linux开发】linux设备驱动归纳总结(四):3.抢占和上下文切换

    linux设备驱动归纳总结(四):3.抢占和上下文切换 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ...

  8. 【Spring Cloud】Spring Cloud使用总结

    项目概要 项目环境信息 IDEA ultimate 2018.3.2 springboot 2.1.7.RELEASE springCloud Greenwich.SR2 Eureka 介绍 基于ne ...

  9. PTA(Advanced Level)1011.World Cup Betting

    With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excite ...

  10. (4.16)mysql备份还原——物理备份之XtraBackup实践

    关键词:XtraBackup实践,物理备份,xtrabackup备份,innobackupex备份 [1]如何使用? [3]系列:innobackupex --help |more [4]系列:xtr ...