summaryrefslogtreecommitdiff
path: root/utils/stringlib.h
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2013-06-20 01:28:43 +0200
committerPatrick Simianer <p@simianer.de>2013-06-20 01:28:43 +0200
commit64fc39f97b62d9575eeb8da8067b1b09b71c0f84 (patch)
tree7475ae5578f40d3deabeef4532e3a81e2c662ad5 /utils/stringlib.h
parent3b9f1972dd2c0874c5845b68f9bd7f955b6d67eb (diff)
parent0dc7755f7fb1ef15db5a60c70866aa61b6367898 (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'utils/stringlib.h')
-rw-r--r--utils/stringlib.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/utils/stringlib.h b/utils/stringlib.h
index ff5dc89d..1bb533d8 100644
--- a/utils/stringlib.h
+++ b/utils/stringlib.h
@@ -268,6 +268,16 @@ inline unsigned int UTF8Len(unsigned char x) {
else return 0;
}
+inline unsigned int UTF8StringLen(const std::string& x) {
+ unsigned pos = 0;
+ int len = 0;
+ while(pos < x.size()) {
+ ++len;
+ pos += UTF8Len(x[pos]);
+ }
+ return len;
+}
+
std::string md5(const std::string& in);
#endif