diff options
Diffstat (limited to 'src/Util.cpp')
| -rw-r--r-- | src/Util.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/Util.cpp b/src/Util.cpp new file mode 100644 index 0000000..4db3773 --- /dev/null +++ b/src/Util.cpp @@ -0,0 +1,20 @@ +#include "Util.hpp" + +namespace Util { + QString& trimQuotes(QString&& string, bool& trimmed) + { + trimmed = false; + if(string.length() >= 2 && string.at(0) == '"' && string.at(string.length() - 1) == '"') + { + string.remove(0, 1); + string.remove(string.length() - 1, 1); + trimmed = true; + } + return string; + } + + QString& trimQuotes(const QString& string, bool& trimmed) + { + return trimQuotes(QString(string), trimmed); + } +} |
