Added utility rstrip() to remove whitespace at the right end of a string.
This commit is contained in:
parent
503b7c64f9
commit
385a7b7b00
@ -77,3 +77,12 @@ QString Utils::getTariffLoadTime(QString fileName) {
|
||||
return "N/A";
|
||||
}
|
||||
|
||||
QString Utils::rstrip(QString const &str) {
|
||||
int n = str.size() - 1;
|
||||
for (; n >= 0; --n) {
|
||||
if (!str.at(n).isSpace()) {
|
||||
return str.left(n + 1);
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user