2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19 * All rights reserved.
21 * The Original Code is: all of this file.
23 * Contributor(s): none yet.
25 * ***** END GPL LICENSE BLOCK *****
28 #ifndef __BLI_STRING_H__
29 #define __BLI_STRING_H__
31 /** \file BLI_string.h
41 char *BLI_strdupn(const char *str, const size_t len)
43 __attribute__((warn_unused_result))
44 __attribute__((nonnull))
48 char *BLI_strdup(const char *str)
50 __attribute__((warn_unused_result))
51 __attribute__((nonnull))
55 char *BLI_strdupcat(const char *__restrict str1, const char *__restrict str2)
57 __attribute__((warn_unused_result))
58 __attribute__((nonnull))
62 char *BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy)
64 __attribute__((nonnull))
68 size_t BLI_strncpy_rlen(char *__restrict dst, const char *__restrict src, const size_t maxncpy)
70 __attribute__((warn_unused_result))
71 __attribute__((nonnull))
75 size_t BLI_strcpy_rlen(char *__restrict dst, const char *__restrict src)
77 __attribute__((warn_unused_result))
78 __attribute__((nonnull))
82 char *BLI_str_quoted_substrN(const char *__restrict str, const char *__restrict prefix)
84 __attribute__((warn_unused_result))
85 __attribute__((nonnull))
89 char *BLI_replacestr(char *__restrict str, const char *__restrict oldText, const char *__restrict newText)
91 __attribute__((warn_unused_result))
92 __attribute__((nonnull))
96 size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format, ...)
98 __attribute__ ((format(printf, 3, 4)))
99 __attribute__((nonnull))
103 size_t BLI_vsnprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format, va_list arg)
105 __attribute__ ((format(printf, 3, 0)))
109 char *BLI_sprintfN(const char *__restrict format, ...)
111 __attribute__ ((format(printf, 1, 2)))
112 __attribute__((warn_unused_result))
113 __attribute__((nonnull))
117 size_t BLI_strescape(char *__restrict dst, const char *__restrict src, const size_t maxncpy)
119 __attribute__((nonnull))
123 int BLI_strcaseeq(const char *a, const char *b)
125 __attribute__((warn_unused_result))
126 __attribute__((nonnull))
130 char *BLI_strcasestr(const char *s, const char *find)
132 __attribute__((warn_unused_result))
133 __attribute__((nonnull))
136 int BLI_strcasecmp(const char *s1, const char *s2)
138 __attribute__((warn_unused_result))
139 __attribute__((nonnull))
142 int BLI_strncasecmp(const char *s1, const char *s2, size_t len)
144 __attribute__((warn_unused_result))
145 __attribute__((nonnull))
148 int BLI_natstrcmp(const char *s1, const char *s2)
150 __attribute__((warn_unused_result))
151 __attribute__((nonnull))
154 size_t BLI_strnlen(const char *str, const size_t maxlen)
156 __attribute__((warn_unused_result))
157 __attribute__((nonnull))
160 void BLI_timestr(double _time, char *str, size_t maxlen)
162 __attribute__((nonnull))
166 void BLI_ascii_strtolower(char *str, const size_t len)
168 __attribute__((nonnull))
171 void BLI_ascii_strtoupper(char *str, const size_t len)
173 __attribute__((nonnull))
176 int BLI_str_rstrip_float_zero(char *str, const char pad)
178 __attribute__((nonnull))