QT -- QString处理
2024-08-28 04:18:54
1. 去掉字符串多余的空格,回车等。
QString QString::simplified () const
Returns a string that has whitespace removed from the start and the end, and that has each sequence of internal whitespace replaced with a single space.
Whitespace means any character for which QChar::isSpace() returns true. This includes the ASCII characters '\t', '\n', '\v', '\f', '\r', and ' '.
Example:
QString str = " lots\t of\nwhitespace\r\n ";
str = str.simplified();
// str == "lots of whitespace";
2.QString 子串分隔
QString test("one,two,three,four,five");
test=test.section(',',2,2); // "three"
test=test.section(',',-2,-2); //"four"
test=test.section(',',2); //"three,four,five"
QString test("oneistwoisthree");
test=test.section("is",1,1);//two
最新文章
- 《JAVA与模式》之组合模式
- codevs 1228 苹果树
- 第一个小项目(天气预报软件)——称";酷狗天气";
- myeclipse开发代码颜色搭配保护视力
- spm使用之五修改spm自带文档主题模板
- .NET自动更新
- Python 技巧
- Spring Boot——开发新一代Spring应用
- [LeetCode66]Plus One
- flex、As 3.0 小知识
- LPC1768IAP(详解,有上位机)
- 原型及原型链,以及prototype和__proto__属性(笔记便于以后复习)
- windows安装IDEA
- 使用双引擎,让kbmmw 的客户端访问更方便
- jQuery-少见获取元素的方式
- [arc066f]Contest with Drinks Hard
- RoR - MetaProgramming
- scala操作HBase2.0
- 牛客练习赛40 C 小A与欧拉路(树的直径)
- QML的Window与ApplicationWindow
热门文章
- 题解 UVa10791
- 一个Tomcat下部署多个项目异常:org.springframework.jmx.export.UnableToRegisterMBeanException: Unable to register MBean 的解决方法
- vue中点击不同的em添加class去除兄弟级class
- 学习Spring-Data-Jpa(十二)---投影Projections-对查询结果的扩展
- 【JZOJ6227】【20190621】ichi
- C++通过迭代修改字符串本身(auto类型说明符)
- last-child为啥不生效
- ICEM-带柱底座
- Kubernetes Pod概述
- [译]在你的GitHub主页固定仓库