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!
This commit is contained in:
@@ -79,6 +79,10 @@ 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();
|
||||
int BLI_str_index_in_array(const char *__restrict str, const char **__restrict str_array) ATTR_NONNULL();
|
||||
|
||||
size_t BLI_str_partition(const char *str, const unsigned int delim[], char **sep, char **suf) ATTR_NONNULL();
|
||||
size_t BLI_str_rpartition(const char *str, const unsigned int delim[], char **sep, char **suf) ATTR_NONNULL();
|
||||
size_t BLI_str_partition_ex(const char *str, const unsigned int delim[], char **sep, char **suf, const bool from_right) ATTR_NONNULL();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user