Blender V5.3
blenlib/intern/string_utils.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2017 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <cctype>
10#include <cstdlib>
11#include <cstring>
12
13#include <array>
14
15#include <stdexcept>
16
17#include "MEM_guardedalloc.h"
18
19#include "BLI_array.hh"
20#include "BLI_listbase.hh"
21#include "BLI_string.hh"
22#include "BLI_string_utf8.hh"
24#include "BLI_string_utils.hh"
25#include "BLI_utildefines.hh"
26
27#include "BLI_dynstr.hh"
28
29#include "DNA_listBase.h"
30
31#include "BLI_strict_flags.hh" /* IWYU pragma: keep. Keep last. */
32
33namespace blender {
34
35/* -------------------------------------------------------------------- */
38
39char *BLI_string_replaceN(const char *__restrict str,
40 const char *__restrict substr_old,
41 const char *__restrict substr_new)
42{
43 DynStr *ds = nullptr;
44 size_t len_old = strlen(substr_old);
45 const char *match;
46
47 BLI_assert(substr_old[0] != '\0');
48
49 /* While we can still find a match for the old sub-string that we're searching for,
50 * keep dicing and replacing. */
51 while ((match = strstr(str, substr_old))) {
52 /* the assembly buffer only gets created when we actually need to rebuild the string */
53 if (ds == nullptr) {
54 ds = BLI_dynstr_new();
55 }
56
57 /* If the match position does not match the current position in the string,
58 * copy the text up to this position and advance the current position in the string. */
59 if (str != match) {
60 /* Add the segment of the string from `str` to match to the buffer,
61 * then restore the value at match. */
62 BLI_dynstr_nappend(ds, str, int(match - str));
63
64 /* now our current position should be set on the start of the match */
65 str = match;
66 }
67
68 /* Add the replacement text to the accumulation buffer. */
69 BLI_dynstr_append(ds, substr_new);
70
71 /* Advance the current position of the string up to the end of the replaced segment. */
72 str += len_old;
73 }
74
75 /* Finish off and return a new string that has had all occurrences of. */
76 if (ds) {
77 char *str_new;
78
79 /* Add what's left of the string to the assembly buffer
80 * - we've been adjusting `str` to point at the end of the replaced segments. */
82
83 /* Convert to new c-string (MEM_new'd), and free the buffer. */
84 str_new = BLI_dynstr_get_cstring(ds);
86
87 return str_new;
88 }
89 /* Just create a new copy of the entire string - we avoid going through the assembly buffer
90 * for what should be a bit more efficiency. */
91 return BLI_strdup(str);
92}
93
94void BLI_string_replace(std::string &haystack, const StringRef needle, const StringRef other)
95{
96 size_t i = 0;
97 size_t index;
98 while ((index = haystack.find(needle, i)) != std::string::npos) {
99 haystack.replace(index, size_t(needle.size()), other);
100 i = index + size_t(other.size());
101 }
102}
103
105{
106 if (str.startswith("-")) {
107 return std::string(str);
108 }
109
110 return std::string(BLI_STR_UTF8_FIGURE_SPACE + str);
111}
112
113void BLI_string_replace_char(char *str, char src, char dst)
114{
115 while (*str) {
116 if (*str == src) {
117 *str = dst;
118 }
119 str++;
120 }
121}
122
124 const size_t string_maxncpy,
125 const char *replace_table[][2],
126 int replace_table_len)
127{
128 BLI_string_debug_size_after_nil(string, string_maxncpy);
129
130 for (int i = 0; i < replace_table_len; i++) {
131 if (STREQ(string, replace_table[i][0])) {
132 BLI_strncpy(string, replace_table[i][1], string_maxncpy);
133 return true;
134 }
135 }
136 return false;
137}
138
140 char *string, size_t string_maxncpy, int src_beg, int src_end, const char *dst)
141{
142 int string_len = int(strlen(string));
143 BLI_assert(src_beg <= src_end);
144 BLI_assert(src_end <= string_len);
145 const int src_len = src_end - src_beg;
146 int dst_len = int(strlen(dst));
147
148 if (src_len < dst_len) {
149 /* Grow, first handle special cases. */
150
151 /* Special case, the src_end is entirely clipped. */
152 if (int(string_maxncpy) <= src_beg + dst_len) [[unlikely]] {
153 /* There is only room for the destination. */
154 dst_len = (int(string_maxncpy) - src_beg) - 1;
155 string_len = src_end;
156 string[string_len] = '\0';
157 }
158
159 const int ofs = dst_len - src_len;
160 /* Clip the string when inserting the destination string exceeds `string_maxncpy`. */
161 if (string_len + ofs >= int(string_maxncpy)) {
162 string_len = (int(string_maxncpy) - ofs) - 1;
163 string[string_len] = '\0';
164 BLI_assert(src_end <= string_len);
165 }
166
167 /* Grow. */
168 memmove(string + (src_end + ofs), string + src_end, size_t(string_len - src_end) + 1);
169 string_len += ofs;
170 }
171 else if (src_len > dst_len) {
172 /* Shrink. */
173 const int ofs = src_len - dst_len;
174 memmove(string + (src_end - ofs), string + src_end, size_t(string_len - src_end) + 1);
175 string_len -= ofs;
176 }
177 else { /* Simple case, no resizing. */
178 BLI_assert(src_len == dst_len);
179 }
180
181 if (dst_len > 0) {
182 memcpy(string + src_beg, dst, size_t(dst_len));
183 }
184 BLI_assert(string[string_len] == '\0');
185 return size_t(string_len);
186}
187
189
190StringRef BLI_string_split_name_number(const StringRef name_full, const char delim, int &r_number)
191{
192 const int64_t delim_index = name_full.rfind(delim);
193 r_number = 0;
194 if (delim_index == StringRef::not_found) {
195 return name_full;
196 }
197
198 StringRef name_base = name_full.substr(0, delim_index);
199
200 if (delim_index < name_full.size() - 1) {
201 const StringRef num_str = name_full.substr(delim_index + 1);
202 if (!std::all_of(num_str.begin(), num_str.end(), ::isdigit)) {
203 return name_full;
204 }
205 /* Converting numerical suffix to an int, can overflow for large numbers. */
206 try {
207 r_number = std::stoi(num_str);
208 return name_base;
209 }
210 catch (std::out_of_range const & /*ex*/) {
211 r_number = 0;
212 }
213 }
214
215 return name_full;
216}
217
218size_t BLI_string_split_name_number(const char *name,
219 const char delim,
220 char *r_name_left,
221 int *r_number)
222{
223 const std::string name_base = BLI_string_split_name_number(name, delim, *r_number);
224 BLI_strncpy(r_name_left, name_base.c_str(), name_base.size() + 1);
225 return name_base.size();
226}
227
228bool BLI_string_is_decimal(const char *string)
229{
230 if (*string == '\0') {
231 return false;
232 }
233
234 /* Keep iterating over the string until a non-digit is found. */
235 while (isdigit(*string)) {
236 string++;
237 }
238
239 /* If the non-digit we found is the terminating \0, everything was digits. */
240 return *string == '\0';
241}
242
243static bool is_char_sep(const char c)
244{
245 return ELEM(c, '.', ' ', '-', '_');
246}
247
248void BLI_string_split_suffix(const char *string,
249 const size_t string_maxlen,
250 char *r_body,
251 char *r_suf)
252{
253 BLI_string_debug_size(r_body, string_maxlen);
254 BLI_string_debug_size(r_suf, string_maxlen);
255
256 size_t len = BLI_strnlen(string, string_maxlen);
257 size_t i;
258
259 r_body[0] = r_suf[0] = '\0';
260
261 for (i = len; i > 0; i--) {
262 if (is_char_sep(string[i])) {
263 BLI_strncpy(r_body, string, i + 1);
264 BLI_strncpy(r_suf, string + i, (len + 1) - i);
265 return;
266 }
267 }
268
269 memcpy(r_body, string, len + 1);
270}
271
272void BLI_string_split_prefix(const char *string,
273 const size_t string_maxlen,
274 char *r_pre,
275 char *r_body)
276{
277 BLI_string_debug_size(r_pre, string_maxlen);
278 BLI_string_debug_size(r_body, string_maxlen);
279
280 size_t len = BLI_strnlen(string, string_maxlen);
281 size_t i;
282
283 r_body[0] = r_pre[0] = '\0';
284
285 for (i = 1; i < len; i++) {
286 if (is_char_sep(string[i])) {
287 i++;
288 BLI_strncpy(r_pre, string, i + 1);
289 BLI_strncpy(r_body, string + i, (len + 1) - i);
290 return;
291 }
292 }
293
294 BLI_strncpy(r_body, string, len);
295}
296
297size_t BLI_string_flip_side_name(char *name_dst,
298 const char *name_src,
299 const bool strip_number,
300 const size_t name_dst_maxncpy)
301{
302 BLI_string_debug_size(name_dst, name_dst_maxncpy);
303
304 size_t len;
305 char *prefix = static_cast<char *>(alloca(name_dst_maxncpy)); /* The part before the facing */
306 char *suffix = static_cast<char *>(alloca(name_dst_maxncpy)); /* The part after the facing */
307 char *number = static_cast<char *>(alloca(name_dst_maxncpy)); /* The number extension string */
308 const char *replace = nullptr;
309 char *index = nullptr;
310 bool is_set = false;
311
312 *prefix = *suffix = *number = '\0';
313
314 /* always copy the name, since this can be called with an uninitialized string */
315 len = BLI_strncpy_utf8_rlen(name_dst, name_src, name_dst_maxncpy);
316 if (len < 3) {
317 /* We don't support names such as `.R` or `.L`. */
318 return len;
319 }
320
321 /* We first check the case with a .### extension, let's find the last period */
322 if (isdigit(name_dst[len - 1])) {
323 index = strrchr(name_dst, '.'); /* Last occurrence. */
324 if (index && isdigit(index[1])) { /* Doesn't handle case `bone.1abc2` correct..., whatever! */
325 if (strip_number == false) {
326 BLI_strncpy_utf8(number, index, name_dst_maxncpy);
327 }
328 *index = '\0';
329 len = size_t(index - name_dst); /* Same as `strlen(name_dst)`. */
330 }
331 }
332
333 BLI_strncpy_utf8(prefix, name_dst, name_dst_maxncpy);
334
335 /* First case; separator (`.` or `_`) with extensions in `r R l L`. */
336 if ((len > 1) && is_char_sep(name_dst[len - 2])) {
337 is_set = true;
338 switch (name_dst[len - 1]) {
339 case 'l':
340 prefix[len - 1] = 0;
341 replace = "r";
342 break;
343 case 'r':
344 prefix[len - 1] = 0;
345 replace = "l";
346 break;
347 case 'L':
348 prefix[len - 1] = 0;
349 replace = "R";
350 break;
351 case 'R':
352 prefix[len - 1] = 0;
353 replace = "L";
354 break;
355 default:
356 is_set = false;
357 }
358 }
359
360 /* case; beginning with r R l L, with separator after it */
361 if (!is_set && is_char_sep(name_dst[1])) {
362 is_set = true;
363 switch (name_dst[0]) {
364 case 'l':
365 replace = "r";
366 BLI_strncpy_utf8(suffix, name_dst + 1, name_dst_maxncpy);
367 prefix[0] = 0;
368 break;
369 case 'r':
370 replace = "l";
371 BLI_strncpy_utf8(suffix, name_dst + 1, name_dst_maxncpy);
372 prefix[0] = 0;
373 break;
374 case 'L':
375 replace = "R";
376 BLI_strncpy_utf8(suffix, name_dst + 1, name_dst_maxncpy);
377 prefix[0] = 0;
378 break;
379 case 'R':
380 replace = "L";
381 BLI_strncpy_utf8(suffix, name_dst + 1, name_dst_maxncpy);
382 prefix[0] = 0;
383 break;
384 default:
385 is_set = false;
386 }
387 }
388
389 if (!is_set && len > 5) {
390 /* Test for a separator to apply the rule: ultimate left or right. */
391 if (((index = BLI_strcasestr(prefix, "right")) == prefix) || (index == prefix + len - 5)) {
392 is_set = true;
393 if (index[0] == 'r') {
394 replace = "left";
395 }
396 else {
397 replace = (index[1] == 'I' ? "LEFT" : "Left");
398 }
399 *index = 0;
400 BLI_strncpy_utf8(suffix, index + 5, name_dst_maxncpy);
401 }
402 else if (((index = BLI_strcasestr(prefix, "left")) == prefix) || (index == prefix + len - 4)) {
403 is_set = true;
404 if (index[0] == 'l') {
405 replace = "right";
406 }
407 else {
408 replace = (index[1] == 'E' ? "RIGHT" : "Right");
409 }
410 *index = 0;
411 BLI_strncpy_utf8(suffix, index + 4, name_dst_maxncpy);
412 }
413 }
414
416 name_dst, name_dst_maxncpy, "%s%s%s%s", prefix, replace ? replace : "", suffix, number);
417}
418
419/* Unique name utils. */
420
422 const char *defname,
423 char delim,
424 char *name,
425 size_t name_maxncpy)
426{
427 BLI_string_debug_size_after_nil(name, name_maxncpy);
428
429 if (name[0] == '\0') {
430 BLI_strncpy_utf8(name, defname, name_maxncpy);
431 }
432
433 if (unique_check(name)) {
434 char numstr[16];
435 char *tempname = static_cast<char *>(alloca(name_maxncpy));
436 char *left = static_cast<char *>(alloca(name_maxncpy));
437 int number;
438 size_t len = BLI_string_split_name_number(name, delim, left, &number);
439 do {
440 const size_t numlen = SNPRINTF_UTF8(numstr, "%c%03d", delim, ++number);
441
442 /* highly unlikely the string only has enough room for the number
443 * but support anyway */
444 if ((len == 0) || (numlen + 1 >= name_maxncpy)) [[unlikely]] {
445 /* Number is known not to be UTF8. */
446 BLI_strncpy(tempname, numstr, name_maxncpy);
447 }
448 else {
449 char *tempname_buf;
450 tempname_buf = tempname + BLI_strncpy_utf8_rlen(tempname, left, name_maxncpy - numlen);
451 memcpy(tempname_buf, numstr, numlen + 1);
452 }
453 } while (unique_check(tempname));
454 /* There will always be enough room for this string. */
455 BLI_strncpy_utf8(name, tempname, name_maxncpy);
456 }
457}
458
459std::string BLI_uniquename_cb(FunctionRef<bool(StringRef)> unique_check,
460 const char delim,
461 const StringRef name)
462{
463 std::string new_name = name;
464
465 if (!unique_check(new_name)) {
466 return new_name;
467 }
468
469 int number;
470 Array<char> left_buffer(int64_t(new_name.size()) + 1);
471 const size_t len = BLI_string_split_name_number(
472 new_name.c_str(), delim, left_buffer.data(), &number);
473
474 const std::string left = left_buffer.data();
475
476 do {
477 std::array<char, 16> num_str;
478 BLI_snprintf(num_str.data(), num_str.size(), "%c%03d", delim, ++number);
479
480 if (len == 0) {
481 new_name = num_str.data();
482 }
483 else {
484 new_name = left + num_str.data();
485 }
486 } while (unique_check(new_name));
487
488 return new_name;
489}
490
492 void *vlink,
493 const char *defname,
494 char delim,
495 int name_offset,
496 size_t name_maxncpy)
497{
498 BLI_assert(name_maxncpy > 1);
499
500 /* See if we are given an empty string */
501 if (ELEM(nullptr, vlink)) {
502 return;
503 }
504
506 [&](const StringRefNull name) {
507 for (Link *link = static_cast<Link *>(list->first_); link; link = link->next) {
508 if (link != vlink) {
509 const char *link_name = POINTER_OFFSET((const char *)link, name_offset);
510 if (name == link_name) {
511 return true;
512 }
513 }
514 }
515 return false;
516 },
517 defname,
518 delim,
519 static_cast<char *>(POINTER_OFFSET(vlink, name_offset)),
520 name_maxncpy);
521}
522
523size_t BLI_string_len_array(const char *strings[], uint strings_num)
524{
525 size_t total_len = 0;
526 for (uint i = 0; i < strings_num; i++) {
527 total_len += strlen(strings[i]);
528 }
529 return total_len;
530}
531
532/* ------------------------------------------------------------------------- */
542
544 size_t result_maxncpy,
545 const char *strings[],
546 uint strings_num)
547{
548 BLI_string_debug_size(result, result_maxncpy);
549
550 char *c = result;
551 char *c_end = &result[result_maxncpy - 1];
552 for (uint i = 0; i < strings_num; i++) {
553 const char *p = strings[i];
554 while (*p) {
555 if (!(c < c_end)) [[unlikely]] {
556 i = strings_num; /* Break outer loop. */
557 break;
558 }
559 *c++ = *p++;
560 }
561 }
562 *c = '\0';
563 return size_t(c - result);
564}
565
567 char *result, size_t result_maxncpy, char sep, const char *strings[], uint strings_num)
568{
569 BLI_string_debug_size(result, result_maxncpy);
570
571 char *c = result;
572 char *c_end = &result[result_maxncpy - 1];
573 for (uint i = 0; i < strings_num; i++) {
574 if (i != 0) {
575 if (!(c < c_end)) [[unlikely]] {
576 break;
577 }
578 *c++ = sep;
579 }
580 const char *p = strings[i];
581 while (*p) {
582 if (!(c < c_end)) [[unlikely]] {
583 i = strings_num; /* Break outer loop. */
584 break;
585 }
586 *c++ = *p++;
587 }
588 }
589 *c = '\0';
590 return size_t(c - result);
591}
592
593char *BLI_string_join_arrayN(const char *strings[], uint strings_num)
594{
595 const size_t result_size = BLI_string_len_array(strings, strings_num) + 1;
596 char *result = MEM_new_array_zeroed<char>(result_size, __func__);
597 char *c = result;
598 for (uint i = 0; i < strings_num; i++) {
599 const size_t string_len = strlen(strings[i]);
600 memcpy(c, strings[i], string_len);
601 c += string_len;
602 }
603 /* Only needed when `strings_num == 0`. */
604 *c = '\0';
605 BLI_assert(result + result_size == c + 1);
606 return result;
607}
608
609char *BLI_string_join_array_by_sep_charN(char sep, const char *strings[], uint strings_num)
610{
611 const size_t result_size = BLI_string_len_array(strings, strings_num) +
612 (strings_num ? strings_num - 1 : 0) + 1;
613 char *result = MEM_new_array_zeroed<char>(result_size, __func__);
614 char *c = result;
615 if (strings_num != 0) {
616 for (uint i = 0; i < strings_num; i++) {
617 const size_t string_len = strlen(strings[i]);
618 memcpy(c, strings[i], string_len);
619 c += string_len;
620 *c = sep;
621 c++;
622 }
623 c--;
624 }
625 *c = '\0';
626 BLI_assert(result + result_size == c + 1);
627 return result;
628}
629
631 char *table[],
632 const char *strings[],
633 uint strings_num)
634{
635 size_t result_size = 0;
636 for (uint i = 0; i < strings_num; i++) {
637 result_size += strlen(strings[i]) + 1;
638 }
639 if (result_size == 0) {
640 result_size = 1;
641 }
642
643 char *result = MEM_new_array_zeroed<char>(result_size, __func__);
644 char *c = result;
645 if (strings_num != 0) {
646 for (uint i = 0; i < strings_num; i++) {
647 const size_t string_len = strlen(strings[i]);
648 memcpy(c, strings[i], string_len);
649 table[i] = c; /* <-- only difference to BLI_string_join_array_by_sep_charN. */
650 memcpy(c, strings[i], string_len);
651 c += string_len;
652 *c = sep;
653 c++;
654 }
655 c--;
656 }
657 *c = '\0';
658 BLI_assert(result + result_size == c + 1);
659 return result;
660}
661
663
664} // namespace blender
A dynamically sized string ADT.
#define BLI_string_debug_size_after_nil(str, str_maxncpy)
#define BLI_string_debug_size(str, str_maxncpy)
#define SNPRINTF_UTF8(dst, format,...)
#define BLI_STR_UTF8_FIGURE_SPACE
These structs are the foundation for all linked lists in the library system.
Read Blender memory allocation and freeing.
#define ELEM(...)
#define POINTER_OFFSET(v, ofs)
#define STREQ(a, b)
const T * data() const
Definition BLI_array.hh:323
constexpr int64_t rfind(char c, int64_t pos=INT64_MAX) const
constexpr const char * end() const
constexpr const char * begin() const
static constexpr int64_t not_found
constexpr int64_t size() const
constexpr StringRef substr(int64_t start, int64_t size) const
#define str(s)
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
Definition math_dual.h:263
BMesh Iterators.
bool BLI_string_is_decimal(const char *string) ATTR_NONNULL(1)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
__int64 int64_t
Definition BKE_text.h:90
size_t BLI_snprintf(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
unsigned int uint
Definition BKE_text.h:55
void BLI_dynstr_nappend(DynStr *__restrict ds, const char *cstr, int len) ATTR_NONNULL()
Definition BLI_dynstr.cc:77
char size_t BLI_strncpy_utf8_rlen(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
void BLI_string_replace_char(char *str, char src, char dst) ATTR_NONNULL(1)
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
char * BLI_string_join_arrayN(const char *strings[], uint strings_num) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
static bool is_char_sep(const char c)
std::string BLI_string_pad_number_sign(blender::StringRef str)
int char * BLI_strcasestr(const char *s, const char *find) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
void BLI_dynstr_free(DynStr *ds) ATTR_NONNULL()
char * BLI_string_join_array_by_sep_charN(char sep, const char *strings[], uint strings_num) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
size_t BLI_string_replace_range(char *string, size_t string_maxncpy, int src_beg, int src_end, const char *dst)
size_t void BLI_uniquename_cb(FunctionRef< bool(StringRefNull)> unique_check, const char *defname, char delim, char *name, size_t name_maxncpy) ATTR_NONNULL(2
void BLI_uniquename(const ListBase *list, void *vlink, const char *defname, char delim, int name_offset, size_t name_maxncpy) ATTR_NONNULL(1
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
void BLI_dynstr_append(DynStr *__restrict ds, const char *cstr) ATTR_NONNULL()
Definition BLI_dynstr.cc:58
void void char * BLI_string_join_array_by_sep_char_with_tableN(char sep, char *table[], const char *strings[], uint strings_num) ATTR_NONNULL(2
int char char int int int int size_t BLI_strnlen(const char *str, size_t maxlen) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
char * BLI_dynstr_get_cstring(const DynStr *ds) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void void BLI_string_split_prefix(const char *string, size_t string_maxlen, char *r_pre, char *r_body) ATTR_NONNULL(1
size_t BLI_string_join_array_by_sep_char(char *result, size_t result_maxncpy, char sep, const char *strings[], uint strings_num) ATTR_NONNULL()
void size_t BLI_string_len_array(const char *strings[], uint strings_num) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
char * BLI_string_replaceN(const char *__restrict str, const char *__restrict substr_old, const char *__restrict substr_new) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
void BLI_string_split_suffix(const char *string, size_t string_maxlen, char *r_body, char *r_suf) ATTR_NONNULL(1
size_t BLI_string_split_name_number(const char *name, char delim, char *r_name_left, int *r_number) ATTR_NONNULL(1
size_t BLI_string_join_array(char *result, size_t result_maxncpy, const char *strings[], uint strings_num) ATTR_NONNULL()
void BLI_string_replace(std::string &haystack, StringRef needle, StringRef other)
size_t BLI_snprintf_utf8_rlen(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
DynStr * BLI_dynstr_new() ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
Definition BLI_dynstr.cc:39
void * MEM_new_array_zeroed(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
size_t BLI_string_flip_side_name(char *name_dst, const char *name_src, bool strip_number, size_t name_dst_maxncpy) ATTR_NONNULL(1
bool BLI_string_replace_table_exact(char *string, size_t string_maxncpy, const char *replace_table[][2], int replace_table_len)
bool is_set(uint i)