diff options
| author | Markus Mittendrein <git@maxmitti.tk> | 2015-11-05 14:45:08 +0100 |
|---|---|---|
| committer | Markus Mittendrein <git@maxmitti.tk> | 2015-11-05 14:45:08 +0100 |
| commit | e08efd9ad57fbe44c68cb98c5cb9b3ac46b96439 (patch) | |
| tree | 7e0fd4036d28e92bb43c2f4bcfd583f9179774b2 /src/Util.cpp | |
| parent | 0b455f219c67063fe52655e2e500db65477fb153 (diff) | |
| download | manager-e08efd9ad57fbe44c68cb98c5cb9b3ac46b96439.tar.gz manager-e08efd9ad57fbe44c68cb98c5cb9b3ac46b96439.zip | |
Add config options IRC.User and IRC.Port
Diffstat (limited to 'src/Util.cpp')
| -rw-r--r-- | src/Util.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/Util.cpp b/src/Util.cpp index 3658802..41500da 100644 --- a/src/Util.cpp +++ b/src/Util.cpp @@ -151,4 +151,41 @@ namespace Util { } return string; } + + int indexOfEscaped(const QString& string, const QChar subject, int startPos, const QChar escapeChar) + { + if(string.isEmpty()) + { + return -1; + } + if(startPos < 0) + { + startPos += string.length(); + } + bool escaped = false; + for(int pos = startPos; pos < string.length(); ++pos) + { + QChar c = string.at(pos); + if(!escaped) + { + if(c == escapeChar) + { + escaped = true; + continue; + } + else + { + if(c == subject) + { + return pos; + } + } + } + else + { + escaped = false; + } + } + return -1; + } } |
