Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/cycles/util/util_string.cpp')
-rw-r--r--intern/cycles/util/util_string.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/intern/cycles/util/util_string.cpp b/intern/cycles/util/util_string.cpp
index 53603c54da0..61a16b63351 100644
--- a/intern/cycles/util/util_string.cpp
+++ b/intern/cycles/util/util_string.cpp
@@ -86,5 +86,24 @@ void string_split(vector<string>& tokens, const string& str, const string& separ
tokens.push_back(token);
}
+bool string_endswith(const string& s, const char *end)
+{
+ size_t len = strlen(end);
+
+ if(len > s.size())
+ return 0;
+ else
+ return strncmp(s.c_str() + s.size() - len, end, len) == 0;
+}
+
+string string_strip(const string& s)
+{
+ string result = s;
+ result.erase(0, result.find_first_not_of(' '));
+ result.erase(result.find_last_not_of(' ') + 1);
+ return result;
+
+}
+
CCL_NAMESPACE_END