diff options
Diffstat (limited to 'src/libutil/StringUtils.cpp')
-rw-r--r-- | src/libutil/StringUtils.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/libutil/StringUtils.cpp b/src/libutil/StringUtils.cpp new file mode 100644 index 0000000..61769c9 --- /dev/null +++ b/src/libutil/StringUtils.cpp @@ -0,0 +1,23 @@ +#include "util/StringUtils.hpp" + +#include <algorithm> +#include <cctype> + +using namespace std; + +bool stringicasecmp( const string &s1, const string &s2 ) +{ + string::const_iterator i1 = s1.begin( ), e1 = s1.end( ), + i2 = s2.begin( ), e2 = s2.end( ); + + while( i1 != e1 && i2 != e2 ) { + if( toupper( *i1 ) != toupper( *i2 ) ) return false; + i1++; + i2++; + } + + if( i1 == e1 && i2 == e2 ) return true; + + return false; +} + |