From e3c8cf0a9ea00ef6c7a63b5fc8351f5f9be1ac8f Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 4 Jul 2014 14:14:06 +0200 Subject: Add (r)partition funcs to BLI_string, to get left-most/right-most first occurence of delimiters. Inspired by Python (r)partition str functions. Also added some Gtest cases for those new funcs. Reviewed by Campbell Barton, many thanks! --- source/blender/blenlib/BLI_string_utf8.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source/blender/blenlib/BLI_string_utf8.h') diff --git a/source/blender/blenlib/BLI_string_utf8.h b/source/blender/blenlib/BLI_string_utf8.h index 4aef2318683..89754be25ba 100644 --- a/source/blender/blenlib/BLI_string_utf8.h +++ b/source/blender/blenlib/BLI_string_utf8.h @@ -66,6 +66,10 @@ int BLI_wcswidth(const wchar_t *pwcs, size_t n) ATTR_NONNULL(); int BLI_str_utf8_char_width(const char *p) ATTR_NONNULL(); /* warning, can return -1 on bad chars */ int BLI_str_utf8_char_width_safe(const char *p) ATTR_NONNULL(); +size_t BLI_str_partition_utf8(const char *str, const unsigned int delim[], char **sep, char **suf) ATTR_NONNULL(); +size_t BLI_str_rpartition_utf8(const char *str, const unsigned int delim[], char **sep, char **suf) ATTR_NONNULL(); +size_t BLI_str_partition_ex_utf8(const char *str, const unsigned int delim[], char **sep, char **suf, const bool from_right) ATTR_NONNULL(); + #define BLI_UTF8_MAX 6 /* mem */ #define BLI_UTF8_WIDTH_MAX 2 /* columns */ #define BLI_UTF8_ERR ((unsigned int)-1) -- cgit v1.2.3