40
* Duplicates the cstring \a str into a newly mallocN'd
41
* string and returns it.
43
* \param str The string to be duplicated
44
* \retval Returns the duplicated string
46
char *BLI_strdup(const char *str);
49
* Duplicates the first \a len bytes of cstring \a str
50
* into a newly mallocN'd string and returns it. \a str
51
* is assumed to be at least len bytes long.
53
* \param str The string to be duplicated
54
* \param len The number of bytes to duplicate
55
* \retval Returns the duplicated string
57
char *BLI_strdupn(const char *str, const size_t len);
60
* Appends the two strings, and returns new mallocN'ed string
61
* \param str1 first string for copy
62
* \param str2 second string for append
65
char *BLI_strdupcat(const char *str1, const char *str2);
68
* Like strncpy but ensures dst is always
71
* \param dst Destination for copy
72
* \param src Source string to copy
73
* \param maxncpy Maximum number of characters to copy (generally
77
char *BLI_strncpy(char *dst, const char *src, const size_t maxncpy);
79
/* Makes a copy of the text within the "" that appear after some text 'blahblah'
80
* i.e. for string 'pose["apples"]' with prefix 'pose[', it should grab "apples"
82
* - str: is the entire string to chop
83
* - prefix: is the part of the string to leave out
85
* Assume that the strings returned must be freed afterwards, and that the inputs will contain
88
char *BLI_getQuotedStr(const char *str, const char *prefix);
91
* Returns a copy of the cstring \a str into a newly mallocN'd
92
* string with all instances of oldText replaced with newText,
95
* \param str The string to replace occurrences of oldText in
96
* \param oldText The text in the string to find and replace
97
* \param newText The text in the string to find and replace
98
* \retval Returns the duplicated string
100
char *BLI_replacestr(char *str, const char *oldText, const char *newText);
103
* Replacement for snprintf
105
size_t BLI_snprintf(char *buffer, size_t len, const char *format, ...)
107
__attribute__ ((format (printf, 3, 4)))
112
* Print formatted string into a newly mallocN'd string
115
char *BLI_sprintfN(const char *format, ...)
117
__attribute__ ((format (printf, 1, 2)))
121
size_t BLI_strescape(char *dst, const char *src, const size_t maxlen);
124
* Compare two strings without regard to case.
126
* \retval True if the strings are equal, false otherwise.
128
int BLI_strcaseeq(const char *a, const char *b);
130
char *BLI_strcasestr(const char *s, const char *find);
131
int BLI_strcasecmp(const char *s1, const char *s2);
132
int BLI_strncasecmp(const char *s1, const char *s2, size_t len);
133
int BLI_natstrcmp(const char *s1, const char *s2);
134
size_t BLI_strnlen(const char *str, size_t maxlen);
135
void BLI_timestr(double _time, char *str); /* time var is global */
137
void BLI_ascii_strtolower(char *str, int len);
138
void BLI_ascii_strtoupper(char *str, int len);
42
* Duplicates the cstring \a str into a newly mallocN'd
43
* string and returns it.
45
* \param str The string to be duplicated
46
* \retval Returns the duplicated string
48
char *BLI_strdup(const char *str)
50
__attribute__((warn_unused_result))
51
__attribute__((nonnull))
56
* Duplicates the first \a len bytes of cstring \a str
57
* into a newly mallocN'd string and returns it. \a str
58
* is assumed to be at least len bytes long.
60
* \param str The string to be duplicated
61
* \param len The number of bytes to duplicate
62
* \retval Returns the duplicated string
64
char *BLI_strdupn(const char *str, const size_t len)
66
__attribute__((warn_unused_result))
67
__attribute__((nonnull))
72
* Appends the two strings, and returns new mallocN'ed string
73
* \param str1 first string for copy
74
* \param str2 second string for append
77
char *BLI_strdupcat(const char *__restrict str1, const char *__restrict str2)
79
__attribute__((warn_unused_result))
80
__attribute__((nonnull))
85
* Like strncpy but ensures dst is always
88
* \param dst Destination for copy
89
* \param src Source string to copy
90
* \param maxncpy Maximum number of characters to copy (generally
94
char *BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy)
96
__attribute__((nonnull))
101
*Makes a copy of the text within the "" that appear after some text 'blahblah'
102
* i.e. for string 'pose["apples"]' with prefix 'pose[', it should grab "apples"
104
* - str: is the entire string to chop
105
* - prefix: is the part of the string to leave out
107
* Assume that the strings returned must be freed afterwards, and that the inputs will contain
110
char *BLI_str_quoted_substrN(const char *__restrict str, const char *__restrict prefix)
112
__attribute__((warn_unused_result))
113
__attribute__((nonnull))
118
* Returns a copy of the cstring \a str into a newly mallocN'd
119
* string with all instances of oldText replaced with newText,
122
* \param str The string to replace occurrences of oldText in
123
* \param oldText The text in the string to find and replace
124
* \param newText The text in the string to find and replace
125
* \retval Returns the duplicated string
127
char *BLI_replacestr(char *__restrict str, const char *__restrict oldText, const char *__restrict newText)
129
__attribute__((warn_unused_result))
130
__attribute__((nonnull))
135
* Replacement for snprintf
137
size_t BLI_snprintf(char *__restrict buffer, size_t len, const char *__restrict format, ...)
139
__attribute__ ((format(printf, 3, 4)))
140
__attribute__((nonnull))
145
* Replacement for vsnprintf
147
size_t BLI_vsnprintf(char *__restrict buffer, size_t count, const char *__restrict format, va_list arg)
149
__attribute__ ((format(printf, 3, 0)))
154
* Print formatted string into a newly mallocN'd string
157
char *BLI_sprintfN(const char *__restrict format, ...)
159
__attribute__ ((format(printf, 1, 2)))
160
__attribute__((warn_unused_result))
161
__attribute__((nonnull))
165
size_t BLI_strescape(char *__restrict dst, const char *__restrict src, const size_t maxncpy)
167
__attribute__((nonnull))
172
* Compare two strings without regard to case.
174
* \retval True if the strings are equal, false otherwise.
176
int BLI_strcaseeq(const char *a, const char *b)
178
__attribute__((warn_unused_result))
179
__attribute__((nonnull))
183
char *BLI_strcasestr(const char *s, const char *find)
185
__attribute__((warn_unused_result))
186
__attribute__((nonnull))
189
int BLI_strcasecmp(const char *s1, const char *s2)
191
__attribute__((warn_unused_result))
192
__attribute__((nonnull))
195
int BLI_strncasecmp(const char *s1, const char *s2, size_t len)
197
__attribute__((warn_unused_result))
198
__attribute__((nonnull))
201
int BLI_natstrcmp(const char *s1, const char *s2)
203
__attribute__((warn_unused_result))
204
__attribute__((nonnull))
207
size_t BLI_strnlen(const char *str, const size_t maxlen)
209
__attribute__((warn_unused_result))
210
__attribute__((nonnull))
213
void BLI_timestr(double _time, char *str)
215
__attribute__((nonnull))
217
; /* time var is global */
219
void BLI_ascii_strtolower(char *str, const size_t len)
221
__attribute__((nonnull))
224
void BLI_ascii_strtoupper(char *str, const size_t len)
226
__attribute__((nonnull))
140
230
#ifdef __cplusplus