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

最新文章

  1. 《JAVA与模式》之组合模式
  2. codevs 1228 苹果树
  3. 第一个小项目(天气预报软件)——称"酷狗天气"
  4. myeclipse开发代码颜色搭配保护视力
  5. spm使用之五修改spm自带文档主题模板
  6. .NET自动更新
  7. Python 技巧
  8. Spring Boot——开发新一代Spring应用
  9. [LeetCode66]Plus One
  10. flex、As 3.0 小知识
  11. LPC1768IAP(详解,有上位机)
  12. 原型及原型链,以及prototype和__proto__属性(笔记便于以后复习)
  13. windows安装IDEA
  14. 使用双引擎,让kbmmw 的客户端访问更方便
  15. jQuery-少见获取元素的方式
  16. [arc066f]Contest with Drinks Hard
  17. RoR - MetaProgramming
  18. scala操作HBase2.0
  19. 牛客练习赛40 C 小A与欧拉路(树的直径)
  20. QML的Window与ApplicationWindow

热门文章

  1. 题解 UVa10791
  2. 一个Tomcat下部署多个项目异常:org.springframework.jmx.export.UnableToRegisterMBeanException: Unable to register MBean 的解决方法
  3. vue中点击不同的em添加class去除兄弟级class
  4. 学习Spring-Data-Jpa(十二)---投影Projections-对查询结果的扩展
  5. 【JZOJ6227】【20190621】ichi
  6. C++通过迭代修改字符串本身(auto类型说明符)
  7. last-child为啥不生效
  8. ICEM-带柱底座
  9. Kubernetes Pod概述
  10. [译]在你的GitHub主页固定仓库