I want to remove all the trailing whitespace characters in a QString. I am looking to do what the Python function str.rstrip() with a QString
QString
str.rstrip()
This is a variation of the answer posted by Frank S. Thomas:
QString rstrip(const QString& str, const char *skip = " \r\n\t") { int n = str.size() - 1; for (; n >= 0; --n) { if (0 == strchr(skip, str.at(n).toAscii())) return str.left(n + 1); } return ""; }