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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-08-15 15:47:48 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-08-15 17:00:40 +0300
commit1d067868c05cc3b8b8b76f6d21ef4a3eebdc885c (patch)
tree41279d3fdb8b1da22b3336981d4314ded90ebf9d /source/blender/blenlib
parent913b8396d971f258df70827274bcdf86dd894185 (diff)
UI: tweak drawing of header status text for transparent headers.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_string.h1
-rw-r--r--source/blender/blenlib/intern/string.c15
2 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h
index faa8dc03615..eef4e0647aa 100644
--- a/source/blender/blenlib/BLI_string.h
+++ b/source/blender/blenlib/BLI_string.h
@@ -85,6 +85,7 @@ size_t BLI_strnlen(const char *str, const size_t maxlen) ATTR_WARN_UNUSED_RESULT
void BLI_str_tolower_ascii(char *str, const size_t len) ATTR_NONNULL();
void BLI_str_toupper_ascii(char *str, const size_t len) ATTR_NONNULL();
+void BLI_str_rstrip(char *str) ATTR_NONNULL();
int BLI_str_rstrip_float_zero(char *str, const char pad) ATTR_NONNULL();
int BLI_str_index_in_array_n(const char *__restrict str, const char **__restrict str_array, const int str_array_len) ATTR_NONNULL();
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