Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenlib/intern/string.c
| Show First 20 Lines • Show All 534 Lines • ▼ Show 20 Lines | while (*str) { | ||||
| if (*str == src) { | if (*str == src) { | ||||
| *str = dst; | *str = dst; | ||||
| } | } | ||||
| str++; | str++; | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Simple exact-match string replacement. | |||||
| * | |||||
| * \param replace_table: Array of source, destination pairs. | |||||
| * | |||||
| * \note Larger tables should use a hash table. | |||||
| */ | |||||
| bool BLI_str_replace_table_exact(char *string, | |||||
| const size_t string_len, | |||||
| const char *replace_table[][2], | |||||
| int replace_table_len) | |||||
| { | |||||
| for (int i = 0; i < replace_table_len; i++) { | |||||
| if (STREQ(string, replace_table[i][0])) { | |||||
| BLI_strncpy(string, replace_table[i][1], string_len); | |||||
| return true; | |||||
| } | |||||
| } | |||||
| return false; | |||||
| } | |||||
| /** \} */ | |||||
| /** | |||||
| * Compare two strings without regard to case. | * Compare two strings without regard to case. | ||||
| * | * | ||||
| * \retval True if the strings are equal, false otherwise. | * \retval True if the strings are equal, false otherwise. | ||||
| */ | */ | ||||
| int BLI_strcaseeq(const char *a, const char *b) | int BLI_strcaseeq(const char *a, const char *b) | ||||
| { | { | ||||
| return (BLI_strcasecmp(a, b) == 0); | return (BLI_strcasecmp(a, b) == 0); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 702 Lines • Show Last 20 Lines | |||||