QString之simplified()含义
生活随笔
收集整理的這篇文章主要介紹了
QString之simplified()含义
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
這個函數把一個字符串首尾的空格不可見字符全部清除,不管首尾是幾個空格哦。字符串中間的空格(包括單個空格、多個空格、'\t', '\n', '\v', '\f', '\r', and ' ')都統一轉化成一個空格 。
注意首尾和中間的不同:首尾是全部清除,中間無論多少個,只保留一個空格
Qt官方幫助手冊解釋如下:
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"; 創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的QString之simplified()含义的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Qt VS Tools用不了解决方法
- 下一篇: QFontDatabase: Canno