common/Util.hpp |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit 7bf59d8f648680747c3a2c26b7836d1b92f9e63a
Author: Tor Lillqvist <[email protected]>
Date:   Mon Jan 15 13:37:40 2018 +0200

    Add Util::startsWith() to check whether a std::string starts with another
    
    Odd that we have managed without such a helper for so long, or did I
    just not find it?

diff --git a/common/Util.hpp b/common/Util.hpp
index eef52464..b4eb3504 100644
--- a/common/Util.hpp
+++ b/common/Util.hpp
@@ -285,6 +285,11 @@ namespace Util
         return trimmed(std::string(s));
     }
 
+    inline bool startsWith(const std::string& s, const std::string& t)
+    {
+        return s.length() >= t.length() && memcmp(s.c_str(), t.c_str(), 
t.length()) == 0;
+    }
+
     /// Given one or more patterns to allow, and one or more to deny,
     /// the match member will return true if, and only if, the subject
     /// matches the allowed list, but not the deny.
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to