diff options
author | Benoit Foucher <benoit@zeroc.com> | 2005-02-10 12:23:44 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2005-02-10 12:23:44 +0000 |
commit | 50a9bc07bf0e76b7bdf993e611037539f42aa385 (patch) | |
tree | a992a0bfc655023325f4856758f7649ab5fcdc5c /cpp/src/IceUtil/StringUtil.cpp | |
parent | adding bidir (diff) | |
download | ice-50a9bc07bf0e76b7bdf993e611037539f42aa385.tar.bz2 ice-50a9bc07bf0e76b7bdf993e611037539f42aa385.tar.xz ice-50a9bc07bf0e76b7bdf993e611037539f42aa385.zip |
Fixed match method to optionally match period (useful for IcePack)
Diffstat (limited to 'cpp/src/IceUtil/StringUtil.cpp')
-rw-r--r-- | cpp/src/IceUtil/StringUtil.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/cpp/src/IceUtil/StringUtil.cpp b/cpp/src/IceUtil/StringUtil.cpp index 72bb715369f..232e30f4f06 100644 --- a/cpp/src/IceUtil/StringUtil.cpp +++ b/cpp/src/IceUtil/StringUtil.cpp @@ -263,7 +263,7 @@ IceUtil::checkQuote(const string& s, string::size_type start) // it's portable across platforms (whereas regex() isn't). // bool -IceUtil::match(const string& s, const string& pat) +IceUtil::match(const string& s, const string& pat, bool matchPeriod) { assert(!s.empty()); assert(!pat.empty()); @@ -279,11 +279,14 @@ IceUtil::match(const string& s, const string& pat) { if(pat[patIndex] == '*') { - if(s[sIndex] == '.') // Don't allow matching x..y against x.*.y -- star matches non-empty sequence only. + // + // Don't allow matching x..y against x.*.y if requested -- star matches non-empty sequence only. + // + if(!matchPeriod && s[sIndex] == '.') { return false; } - while(sIndex < s.size() && s[sIndex] != '.') + while(sIndex < s.size() && (matchPeriod || s[sIndex] != '.')) { ++sIndex; } |