X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fstrings%2Futils.cpp;h=1b4cad080dee85950740b58de822484be2c2214e;hp=416188ec3d574e71caaecf2fa4353eaff8f67564;hb=20c897ece781e18ba54c41fd68e232ce566a938d;hpb=4418103963cca2b68fd2dbf6d1d16eeebc8b3c40 diff --git a/source/strings/utils.cpp b/source/strings/utils.cpp index 416188e..1b4cad0 100644 --- a/source/strings/utils.cpp +++ b/source/strings/utils.cpp @@ -40,7 +40,7 @@ vector do_split(const string &str, const string &sep, int max_split) return result; } -bool check_str(const std::string &str, int (*pred)(int)) +bool check_str(const string &str, int (*pred)(int)) { for(string::const_iterator i=str.begin(); i!=str.end(); ++i) if(!pred(*i)) @@ -130,7 +130,21 @@ string strip(const string &s) return result; } -string c_unescape(const std::string &str) +string &append(string &str, const string &sep, const string &other) +{ + if(!str.empty() && !other.empty()) + str += sep; + str += other; + return str; +} + +string join(const string &str1, const string &sep, const string &str2) +{ + string result = str1; + return append(result, sep, str2); +} + +string c_unescape(const string &str) { bool escape = false; unsigned numeric_type = 0;