diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-05-03 12:32:26 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-05-03 12:32:26 +0100 |
| commit | d003793402ee5e9c0ee2a5a7c96e03f67f7b84cc (patch) | |
| tree | 0818ee749cc393ec3c79130f16162fe669815a1e /src/util.cc | |
| parent | 7cdb6a5253d1dcb0ebb8b1569dde5f5eb9c9df72 (diff) | |
Add ids_equal().
Diffstat (limited to 'src/util.cc')
| -rw-r--r-- | src/util.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util.cc b/src/util.cc index 80c3756b..3d37454f 100644 --- a/src/util.cc +++ b/src/util.cc @@ -40,6 +40,7 @@ #include <libxml++/document.h> #include <openssl/sha.h> #include <boost/filesystem.hpp> +#include <boost/algorithm/string.hpp> #include <stdexcept> #include <sstream> #include <iostream> @@ -58,6 +59,7 @@ using std::ostream; using boost::shared_ptr; using boost::optional; using boost::function; +using boost::algorithm::trim; using namespace dcp; /** Create a UUID. @@ -356,3 +358,13 @@ dcp::relative_to_root (boost::filesystem::path root, boost::filesystem::path fil return rel; } + +bool +dcp::ids_equal (string a, string b) +{ + transform (a.begin(), a.end(), a.begin(), ::tolower); + transform (b.begin(), b.end(), b.begin(), ::tolower); + trim (a); + trim (b); + return a == b; +} |
