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 'source/blender/blenlib/intern/string.c')
-rw-r--r--source/blender/blenlib/intern/string.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c
index c1696a912ba..f46676ac0cd 100644
--- a/source/blender/blenlib/intern/string.c
+++ b/source/blender/blenlib/intern/string.c
@@ -779,6 +779,21 @@ void BLI_str_toupper_ascii(char *str, const size_t len)
}
/**
+ * Strip whitespace from end of the string.
+ */
+void BLI_str_rstrip(char *str)
+{
+ for (int i = strlen(str) - 1; i > 0; i--) {
+ if (isspace(str[i])) {
+ str[i] = '\0';
+ }
+ else {
+ break;
+ }
+ }
+}
+
+/**
* Strip trailing zeros from a float, eg:
* 0.0000 -> 0.0
* 2.0010 -> 2.001