diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2020-02-12 14:48:44 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2020-02-15 22:33:16 +0300 |
commit | 007f1b74a67302fb4c164eb26969419434a98aee (patch) | |
tree | f56ba0eecbbc11fc22e6a47aa0d76582e553e3da /source/blender/blenlib/intern/string.c | |
parent | 6701db773e660e5306e305a1b10f8ea52955f06b (diff) |
Cleanup: split off code from gpu_codegen.c into smaller files
Diffstat (limited to 'source/blender/blenlib/intern/string.c')
-rw-r--r-- | source/blender/blenlib/intern/string.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c index 1eed59e568e..acc256226d2 100644 --- a/source/blender/blenlib/intern/string.c +++ b/source/blender/blenlib/intern/string.c @@ -900,6 +900,24 @@ int BLI_str_index_in_array(const char *__restrict str, const char **__restrict s return -1; } +/** + * Find if a string starts with another string. + * + * \param str: The string to search within. + * \param start: The string we look for at the start. + * \return If str starts with start. + */ +bool BLI_str_startswith(const char *__restrict str, const char *__restrict start) +{ + for (; *str && *start; str++, start++) { + if (*str != *start) { + return false; + } + } + + return (*start == '\0'); +} + bool BLI_strn_endswith(const char *__restrict str, const char *__restrict end, size_t slength) { size_t elength = strlen(end); |