如何在 c++11 中检测来自 istream 的空白行
How to detect blank lines from istream in c++11?
如何在 c++11 中检测来自 istream 的空白行?
有没有一个简单的方法,或者我将不得不做类似的事情删除空格和制表符,然后查看生成的字符串是否是空的?
std::string s;
if (!std::getline(in, s)) {
// There wasn't another line.
}
auto pred = [](unsigned char const c) { return std::isblank(c); };
if (std::all_of(s.begin(), s.end(), pred)) {
// This line was empty.
}
相关文章:
- 无法通过空白将文本文件行分隔为矢量
- 为什么istream不支持右值提取
- 将无符号char*转换为std::istream*C++
- 需要从 istream 和 ostream 派生 iostream
- 使用std::istream::peek()总是安全的吗
- 使用 istream 参数读取的 istream 函数
- 由cin中的字符串中未捕获空白引起的分割错误
- istream std::cin如何修改自定义istream缓冲区
- 尝试从 XamlApplication 编译 C++/WinRT 空白应用程序时,我收到未解析的外部符号 winrt_make_*
- 为什么我在使用 istream 迭代器时会出现 seg 错误?
- 代码精简版页面变为空白
- 在清除 istream 之前,我不应该需要取消获取它吗?
- C++,如何根据运行时条件构造引用不同 istream 对象的对象?
- 在OpenCV C++中创建空白图像
- Gtkmm 窗口为空白,不显示任何小部件或标题
- 如何将QByteArray转换为std::istream或std::ifstream?
- 逗号在重载 ostream 和 istream 在结构中分开
- 接受 istream 的空白值
- std :: getline从iStream中直至字符串[]多次空白
- Istream最多使用N个空白字符