QT如何去掉字符串中的空格

如题所述

返回一个字符串,移除从一开始到结尾的空白,每个序列内部的空格替换为一个空格(头尾的都去掉了)举个例子:[cpp]<SPAN style=FONT-SIZE: 18px QString str = lots\t of\nwhitespace\r\n ;str = str.simplified();// str == lots of whitespace;</SPANQString str = lots\t of\nwhitespace\r\n ;str = str.simplified();// str == lots of whitespace;'\t', '\n', '\v', '\f', '\r', ' ' 都属于空白的处理范围。2.QString QString::trimmed() constReturns a string that has whitespace removed from the start and the end.返回一个字符串,移除从一开始到结尾的空白。
温馨提示:答案为网友推荐,仅供参考
相似回答