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_utils.c')
-rw-r--r--source/blender/blenlib/intern/string_utils.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/string_utils.c b/source/blender/blenlib/intern/string_utils.c
index f2b3ef2ad87..b956e1c0a7e 100644
--- a/source/blender/blenlib/intern/string_utils.c
+++ b/source/blender/blenlib/intern/string_utils.c
@@ -82,6 +82,21 @@ size_t BLI_split_name_num(char *left, int *nr, const char *name, const char deli
return name_len;
}
+bool BLI_string_is_decimal(const char *string)
+{
+ if (*string == '\0') {
+ return false;
+ }
+
+ /* Keep iterating over the string until a non-digit is found. */
+ while (isdigit(*string)) {
+ string++;
+ }
+
+ /* If the non-digit we found is the terminating \0, everything was digits. */
+ return *string == '\0';
+}
+
static bool is_char_sep(const char c)
{
return ELEM(c, '.', ' ', '-', '_');