- 判断字符是否是特殊字符
bool QChar::isSpace() const
- 去除开头结尾中间的特殊字符,中间只留一个空格
QString str = " lots\t of\nwhitespace\r\n ";
str = str.simplified();
// str == "lots of whitespace";
- 只去除开头结尾的特殊字符
QString str = " lots\t of\nwhitespace\r\n ";
str = str.trimmed();
// str == "lots\t of\nwhitespace"