Sun, 29 Dec 2019 11:29:17 +0100
adds string replace functions
20
db7d9860dbbd
added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | /* |
103
08018864fb91
added license and copyright notice to all files
Mike Becker <universe@uap-core.de>
parents:
96
diff
changeset
|
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
08018864fb91
added license and copyright notice to all files
Mike Becker <universe@uap-core.de>
parents:
96
diff
changeset
|
3 | * |
259 | 4 | * Copyright 2017 Mike Becker, Olaf Wintermann All rights reserved. |
103
08018864fb91
added license and copyright notice to all files
Mike Becker <universe@uap-core.de>
parents:
96
diff
changeset
|
5 | * |
08018864fb91
added license and copyright notice to all files
Mike Becker <universe@uap-core.de>
parents:
96
diff
changeset
|
6 | * Redistribution and use in source and binary forms, with or without |
08018864fb91
added license and copyright notice to all files
Mike Becker <universe@uap-core.de>
parents:
96
diff
changeset
|
7 | * modification, are permitted provided that the following conditions are met: |
08018864fb91
added license and copyright notice to all files
Mike Becker <universe@uap-core.de>
parents:
96
diff
changeset
|
8 | * |
08018864fb91
added license and copyright notice to all files
Mike Becker <universe@uap-core.de>
parents:
96
diff
changeset
|
9 | * 1. Redistributions of source code must retain the above copyright |
08018864fb91
added license and copyright notice to all files
Mike Becker <universe@uap-core.de>
parents:
96
diff
changeset
|
10 | * notice, this list of conditions and the following disclaimer. |
20
db7d9860dbbd
added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
11 | * |
103
08018864fb91
added license and copyright notice to all files
Mike Becker <universe@uap-core.de>
parents:
96
diff
changeset
|
12 | * 2. Redistributions in binary form must reproduce the above copyright |
08018864fb91
added license and copyright notice to all files
Mike Becker <universe@uap-core.de>
parents:
96
diff
changeset
|
13 | * notice, this list of conditions and the following disclaimer in the |
08018864fb91
added license and copyright notice to all files
Mike Becker <universe@uap-core.de>
parents:
96
diff
changeset
|
14 | * documentation and/or other materials provided with the distribution. |
08018864fb91
added license and copyright notice to all files
Mike Becker <universe@uap-core.de>
parents:
96
diff
changeset
|
15 | * |
08018864fb91
added license and copyright notice to all files
Mike Becker <universe@uap-core.de>
parents:
96
diff
changeset
|
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
08018864fb91
added license and copyright notice to all files
Mike Becker <universe@uap-core.de>
parents:
96
diff
changeset
|
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
08018864fb91
added license and copyright notice to all files
Mike Becker <universe@uap-core.de>
parents:
96
diff
changeset
|
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
08018864fb91
added license and copyright notice to all files
Mike Becker <universe@uap-core.de>
parents:
96
diff
changeset
|
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
08018864fb91
added license and copyright notice to all files
Mike Becker <universe@uap-core.de>
parents:
96
diff
changeset
|
20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
08018864fb91
added license and copyright notice to all files
Mike Becker <universe@uap-core.de>
parents:
96
diff
changeset
|
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
08018864fb91
added license and copyright notice to all files
Mike Becker <universe@uap-core.de>
parents:
96
diff
changeset
|
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
08018864fb91
added license and copyright notice to all files
Mike Becker <universe@uap-core.de>
parents:
96
diff
changeset
|
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
08018864fb91
added license and copyright notice to all files
Mike Becker <universe@uap-core.de>
parents:
96
diff
changeset
|
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
08018864fb91
added license and copyright notice to all files
Mike Becker <universe@uap-core.de>
parents:
96
diff
changeset
|
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
08018864fb91
added license and copyright notice to all files
Mike Becker <universe@uap-core.de>
parents:
96
diff
changeset
|
26 | * POSSIBILITY OF SUCH DAMAGE. |
20
db7d9860dbbd
added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
27 | */ |
116
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
28 | /** |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
29 | * Bounded string implementation. |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
30 | * |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
31 | * The UCX strings (<code>sstr_t</code>) provide an alternative to C strings. |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
32 | * The main difference to C strings is, that <code>sstr_t</code> does <b>not |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
33 | * need to be <code>NULL</code>-terminated</b>. Instead the length is stored |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
34 | * within the structure. |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
35 | * |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
36 | * When using <code>sstr_t</code>, developers must be full aware of what type |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
37 | * of string (<code>NULL</code>-terminated) or not) they are using, when |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
38 | * accessing the <code>char* ptr</code> directly. |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
39 | * |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
40 | * The UCX string module provides some common string functions, known from |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
41 | * standard libc, working with <code>sstr_t</code>. |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
42 | * |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
43 | * @file string.h |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
44 | * @author Mike Becker |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
45 | * @author Olaf Wintermann |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
46 | */ |
20
db7d9860dbbd
added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
47 | |
116
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
48 | #ifndef UCX_STRING_H |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
49 | #define UCX_STRING_H |
20
db7d9860dbbd
added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
50 | |
259 | 51 | #include "ucx.h" |
52 | #include "allocator.h" | |
38
35f67a8ef875
added missing stddef includes
Mike Becker <universe@uap-core.de>
parents:
31
diff
changeset
|
53 | #include <stddef.h> |
35f67a8ef875
added missing stddef includes
Mike Becker <universe@uap-core.de>
parents:
31
diff
changeset
|
54 | |
325
a3e63cb21e20
changes sstr shortcut macros s.t. they distinguish sstr_t and scstr_t + add macros which can completely disable the shortcuts
Mike Becker <universe@uap-core.de>
parents:
322
diff
changeset
|
55 | /* |
a3e63cb21e20
changes sstr shortcut macros s.t. they distinguish sstr_t and scstr_t + add macros which can completely disable the shortcuts
Mike Becker <universe@uap-core.de>
parents:
322
diff
changeset
|
56 | * Use this macro to disable the shortcuts if you experience macro collision. |
a3e63cb21e20
changes sstr shortcut macros s.t. they distinguish sstr_t and scstr_t + add macros which can completely disable the shortcuts
Mike Becker <universe@uap-core.de>
parents:
322
diff
changeset
|
57 | */ |
a3e63cb21e20
changes sstr shortcut macros s.t. they distinguish sstr_t and scstr_t + add macros which can completely disable the shortcuts
Mike Becker <universe@uap-core.de>
parents:
322
diff
changeset
|
58 | #ifndef UCX_NO_SSTR_SHORTCUTS |
a3e63cb21e20
changes sstr shortcut macros s.t. they distinguish sstr_t and scstr_t + add macros which can completely disable the shortcuts
Mike Becker <universe@uap-core.de>
parents:
322
diff
changeset
|
59 | /** |
a3e63cb21e20
changes sstr shortcut macros s.t. they distinguish sstr_t and scstr_t + add macros which can completely disable the shortcuts
Mike Becker <universe@uap-core.de>
parents:
322
diff
changeset
|
60 | * Shortcut for a <code>sstr_t struct</code> |
a3e63cb21e20
changes sstr shortcut macros s.t. they distinguish sstr_t and scstr_t + add macros which can completely disable the shortcuts
Mike Becker <universe@uap-core.de>
parents:
322
diff
changeset
|
61 | * or <code>scstr_t struct</code> literal. |
a3e63cb21e20
changes sstr shortcut macros s.t. they distinguish sstr_t and scstr_t + add macros which can completely disable the shortcuts
Mike Becker <universe@uap-core.de>
parents:
322
diff
changeset
|
62 | */ |
a3e63cb21e20
changes sstr shortcut macros s.t. they distinguish sstr_t and scstr_t + add macros which can completely disable the shortcuts
Mike Becker <universe@uap-core.de>
parents:
322
diff
changeset
|
63 | #define ST(s) { s, sizeof(s)-1 } |
146
aa376dba1ba8
fixed documentation for netbeans parser + added sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
125
diff
changeset
|
64 | |
116
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
65 | /** Shortcut for the conversion of a C string to a <code>sstr_t</code>. */ |
325
a3e63cb21e20
changes sstr shortcut macros s.t. they distinguish sstr_t and scstr_t + add macros which can completely disable the shortcuts
Mike Becker <universe@uap-core.de>
parents:
322
diff
changeset
|
66 | #define S(s) sstrn(s, sizeof(s)-1) |
20
db7d9860dbbd
added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
67 | |
325
a3e63cb21e20
changes sstr shortcut macros s.t. they distinguish sstr_t and scstr_t + add macros which can completely disable the shortcuts
Mike Becker <universe@uap-core.de>
parents:
322
diff
changeset
|
68 | /** Shortcut for the conversion of a C string to a <code>scstr_t</code>. */ |
a3e63cb21e20
changes sstr shortcut macros s.t. they distinguish sstr_t and scstr_t + add macros which can completely disable the shortcuts
Mike Becker <universe@uap-core.de>
parents:
322
diff
changeset
|
69 | #define SC(s) scstrn(s, sizeof(s)-1) |
a3e63cb21e20
changes sstr shortcut macros s.t. they distinguish sstr_t and scstr_t + add macros which can completely disable the shortcuts
Mike Becker <universe@uap-core.de>
parents:
322
diff
changeset
|
70 | #endif /* UCX_NO_SSTR_SHORTCUTS */ |
a3e63cb21e20
changes sstr shortcut macros s.t. they distinguish sstr_t and scstr_t + add macros which can completely disable the shortcuts
Mike Becker <universe@uap-core.de>
parents:
322
diff
changeset
|
71 | |
a3e63cb21e20
changes sstr shortcut macros s.t. they distinguish sstr_t and scstr_t + add macros which can completely disable the shortcuts
Mike Becker <universe@uap-core.de>
parents:
322
diff
changeset
|
72 | /* |
a3e63cb21e20
changes sstr shortcut macros s.t. they distinguish sstr_t and scstr_t + add macros which can completely disable the shortcuts
Mike Becker <universe@uap-core.de>
parents:
322
diff
changeset
|
73 | * Use this macro to disable the format macros. |
a3e63cb21e20
changes sstr shortcut macros s.t. they distinguish sstr_t and scstr_t + add macros which can completely disable the shortcuts
Mike Becker <universe@uap-core.de>
parents:
322
diff
changeset
|
74 | */ |
a3e63cb21e20
changes sstr shortcut macros s.t. they distinguish sstr_t and scstr_t + add macros which can completely disable the shortcuts
Mike Becker <universe@uap-core.de>
parents:
322
diff
changeset
|
75 | #ifndef UCX_NO_SSTR_FORMAT_MACROS |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
76 | /** Expands a sstr_t or scstr_t to printf arguments. */ |
283
c3b6ff227481
adds more convenience macros for sstr
Mike Becker <universe@uap-core.de>
parents:
259
diff
changeset
|
77 | #define SFMT(s) (int) (s).length, (s).ptr |
c3b6ff227481
adds more convenience macros for sstr
Mike Becker <universe@uap-core.de>
parents:
259
diff
changeset
|
78 | |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
79 | /** Format specifier for a sstr_t or scstr_t. */ |
283
c3b6ff227481
adds more convenience macros for sstr
Mike Becker <universe@uap-core.de>
parents:
259
diff
changeset
|
80 | #define PRIsstr ".*s" |
325
a3e63cb21e20
changes sstr shortcut macros s.t. they distinguish sstr_t and scstr_t + add macros which can completely disable the shortcuts
Mike Becker <universe@uap-core.de>
parents:
322
diff
changeset
|
81 | #endif /* UCX_NO_SSTR_FORMAT_MACROS */ |
283
c3b6ff227481
adds more convenience macros for sstr
Mike Becker <universe@uap-core.de>
parents:
259
diff
changeset
|
82 | |
20
db7d9860dbbd
added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
83 | #ifdef __cplusplus |
db7d9860dbbd
added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
84 | extern "C" { |
db7d9860dbbd
added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
85 | #endif |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
86 | |
116
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
87 | /** |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
88 | * The UCX string structure. |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
89 | */ |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
90 | typedef struct { |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
91 | /** A pointer to the string |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
92 | * (<b>not necessarily <code>NULL</code>-terminated</b>) */ |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
93 | char *ptr; |
116
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
94 | /** The length of the string */ |
20
db7d9860dbbd
added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
95 | size_t length; |
db7d9860dbbd
added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
96 | } sstr_t; |
db7d9860dbbd
added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
97 | |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
98 | /** |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
99 | * The UCX string structure for immutable (constant) strings. |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
100 | */ |
275
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
101 | typedef struct { |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
102 | /** A constant pointer to the immutable string |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
103 | * (<b>not necessarily <code>NULL</code>-terminated</b>) */ |
275
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
104 | const char *ptr; |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
105 | /** The length of the string */ |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
106 | size_t length; |
275
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
107 | } scstr_t; |
288
6af5798342e8
makes sstrcat and sstrnlen scstr_t compatible
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
276
diff
changeset
|
108 | |
275
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
109 | #ifdef __cplusplus |
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
110 | } |
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
111 | #endif |
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
112 | |
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
113 | |
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
114 | #ifdef __cplusplus |
321
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
115 | /** |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
116 | * One of two type adjustment functions that return an scstr_t. |
321
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
117 | * |
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
118 | * Used <b>internally</b> to convert a UCX string to an immutable UCX string. |
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
119 | * |
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
120 | * <b>Do not use this function manually.</b> |
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
121 | * |
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
122 | * @param str some sstr_t |
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
123 | * @return an immutable (scstr_t) version of the provided string. |
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
124 | */ |
275
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
125 | inline scstr_t s2scstr(sstr_t s) { |
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
126 | scstr_t c; |
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
127 | c.ptr = s.ptr; |
328 | 128 | c.length = s.length; |
275
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
129 | return c; |
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
130 | } |
321
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
131 | |
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
132 | /** |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
133 | * One of two type adjustment functions that return an scstr_t. |
321
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
134 | * |
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
135 | * Used <b>internally</b> to convert a UCX string to an immutable UCX string. |
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
136 | * This variant is used, when the string is already immutable and no operation |
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
137 | * needs to be performed. |
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
138 | * |
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
139 | * <b>Do not use this function manually.</b> |
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
140 | * |
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
141 | * @param str some scstr_t |
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
142 | * @return the argument itself |
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
143 | */ |
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
144 | inline scstr_t s2scstr(scstr_t str) { |
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
145 | return str; |
275
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
146 | } |
321
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
147 | |
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
148 | /** |
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
149 | * Converts a UCX string to an immutable UCX string (scstr_t). |
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
150 | * @param str some UCX string |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
151 | * @return an immutable version of the provided string |
321
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
152 | */ |
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
153 | #define SCSTR(s) s2scstr(s) |
275
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
154 | #else |
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
155 | |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
156 | /** |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
157 | * One of two type adjustment functions that return an scstr_t. |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
158 | * |
321
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
159 | * Used <b>internally</b> to convert a UCX string to an immutable UCX string. |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
160 | * This variant is used, when the string is already immutable and no operation |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
161 | * needs to be performed. |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
162 | * |
321
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
163 | * <b>Do not use this function manually.</b> |
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
164 | * |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
165 | * @param str some scstr_t |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
166 | * @return the argument itself |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
167 | */ |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
168 | scstr_t ucx_sc2sc(scstr_t str); |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
169 | |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
170 | /** |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
171 | * One of two type adjustment functions that return an scstr_t. |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
172 | * |
321
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
173 | * Used <b>internally</b> to convert a UCX string to an immutable UCX string. |
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
174 | * |
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
175 | * <b>Do not use this function manually.</b> |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
176 | * |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
177 | * @param str some sstr_t |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
178 | * @return an immutable (scstr_t) version of the provided string. |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
179 | */ |
275
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
180 | scstr_t ucx_ss2sc(sstr_t str); |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
181 | |
275
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
182 | #if __STDC_VERSION__ >= 201112L |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
183 | /** |
321
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
184 | * Converts a UCX string to an immutable UCX string (scstr_t). |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
185 | * @param str some UCX string |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
186 | * @return an immutable version of the provided string |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
187 | */ |
275
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
188 | #define SCSTR(str) _Generic(str, sstr_t: ucx_ss2sc, scstr_t: ucx_sc2sc)(str) |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
189 | |
275
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
190 | #elif defined(__GNUC__) || defined(__clang__) |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
191 | |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
192 | /** |
321
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
193 | * Converts a UCX string to an immutable UCX string (scstr_t). |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
194 | * @param str some UCX string |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
195 | * @return an immutable version of the provided string |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
196 | */ |
275
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
197 | #define SCSTR(str) __builtin_choose_expr( \ |
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
198 | __builtin_types_compatible_p(typeof(str), sstr_t), \ |
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
199 | ucx_ss2sc, \ |
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
200 | ucx_sc2sc)(str) |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
201 | |
275
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
202 | #elif defined(__sun) |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
203 | |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
204 | /** |
321
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
205 | * Converts a UCX string to an immutable UCX string (scstr_t). |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
206 | * @param str some UCX string |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
207 | * @return the an immutable version of the provided string |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
208 | */ |
275
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
209 | #define SCSTR(str) ({typeof(str) ucx_tmp_var_str = str; \ |
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
210 | scstr_t ucx_tmp_var_c; \ |
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
211 | ucx_tmp_var_c.ptr = ucx_tmp_var_str.ptr;\ |
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
212 | ucx_tmp_var_c.length = ucx_tmp_var_str.length;\ |
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
213 | ucx_tmp_var_c; }) |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
214 | #else /* no generics and no builtins */ |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
215 | |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
216 | /** |
321
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
217 | * Converts a UCX string to an immutable UCX string (scstr_t). |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
218 | * |
322
fd21d1840dff
Tags finalization of the scstr_t integration.
Mike Becker <universe@uap-core.de>
parents:
321
diff
changeset
|
219 | * This <b>internal</b> function (ab)uses the C standard an expects one single |
320
0ffb71f15426
use 'convert' as more precise term than 'cast' for the conversion from sstr_t to scstr_t
Mike Becker <universe@uap-core.de>
parents:
319
diff
changeset
|
220 | * argument which is then implicitly converted to scstr_t without a warning. |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
221 | * |
322
fd21d1840dff
Tags finalization of the scstr_t integration.
Mike Becker <universe@uap-core.de>
parents:
321
diff
changeset
|
222 | * <b>Do not use this function manually.</b> |
fd21d1840dff
Tags finalization of the scstr_t integration.
Mike Becker <universe@uap-core.de>
parents:
321
diff
changeset
|
223 | * |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
224 | * @return the an immutable version of the provided string |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
225 | */ |
275
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
226 | scstr_t ucx_ss2c_s(); |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
227 | |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
228 | /** |
321
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
229 | * Converts a UCX string to an immutable UCX string (scstr_t). |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
230 | * @param str some UCX string |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
231 | * @return the an immutable version of the provided string |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
232 | */ |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
233 | #define SCSTR(str) ucx_ss2c_s(str) |
275
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
234 | #endif /* C11 feature test */ |
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
235 | |
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
236 | #endif /* C++ */ |
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
237 | |
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
238 | #ifdef __cplusplus |
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
239 | extern "C" { |
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
240 | #endif |
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
241 | |
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
242 | |
116
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
243 | /** |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
244 | * Creates a new sstr_t based on a C string. |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
245 | * |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
246 | * The length is implicitly inferred by using a call to <code>strlen()</code>. |
20
db7d9860dbbd
added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
247 | * |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
248 | * <b>Note:</b> the sstr_t will share the specified pointer to the C string. |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
249 | * If you do want a copy, use sstrdup() on the return value of this function. |
116
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
250 | * |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
251 | * If you need to wrap a constant string, use scstr(). |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
252 | * |
116
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
253 | * @param cstring the C string to wrap |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
254 | * @return a new sstr_t containing the C string |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
255 | * |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
256 | * @see sstrn() |
20
db7d9860dbbd
added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
257 | */ |
116
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
258 | sstr_t sstr(char *cstring); |
20
db7d9860dbbd
added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
259 | |
116
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
260 | /** |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
261 | * Creates a new sstr_t of the specified length based on a C string. |
20
db7d9860dbbd
added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
262 | * |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
263 | * <b>Note:</b> the sstr_t will share the specified pointer to the C string. |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
264 | * If you do want a copy, use sstrdup() on the return value of this function. |
116
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
265 | * |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
266 | * If you need to wrap a constant string, use scstrn(). |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
267 | * |
116
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
268 | * @param cstring the C string to wrap |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
269 | * @param length the length of the string |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
270 | * @return a new sstr_t containing the C string |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
271 | * |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
272 | * @see sstr() |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
273 | * @see S() |
20
db7d9860dbbd
added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
274 | */ |
116
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
275 | sstr_t sstrn(char *cstring, size_t length); |
20
db7d9860dbbd
added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
276 | |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
277 | /** |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
278 | * Creates a new scstr_t based on a constant C string. |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
279 | * |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
280 | * The length is implicitly inferred by using a call to <code>strlen()</code>. |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
281 | * |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
282 | * <b>Note:</b> the scstr_t will share the specified pointer to the C string. |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
283 | * If you do want a copy, use scstrdup() on the return value of this function. |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
284 | * |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
285 | * @param cstring the C string to wrap |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
286 | * @return a new scstr_t containing the C string |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
287 | * |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
288 | * @see scstrn() |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
289 | */ |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
290 | scstr_t scstr(const char *cstring); |
20
db7d9860dbbd
added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
291 | |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
292 | |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
293 | /** |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
294 | * Creates a new scstr_t of the specified length based on a constant C string. |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
295 | * |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
296 | * <b>Note:</b> the scstr_t will share the specified pointer to the C string. |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
297 | * If you do want a copy, use scstrdup() on the return value of this function. * |
316
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
298 | * |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
299 | * @param cstring the C string to wrap |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
300 | * @param length the length of the string |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
301 | * @return a new scstr_t containing the C string |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
302 | * |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
303 | * @see scstr() |
be0f6bd10b52
adjusts documentation of UCX string types, converters, and constructors
Mike Becker <universe@uap-core.de>
parents:
315
diff
changeset
|
304 | */ |
275
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
305 | scstr_t scstrn(const char *cstring, size_t length); |
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
306 | |
116
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
307 | /** |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
308 | * Returns the accumulated length of all specified strings. |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
309 | * |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
310 | * <b>Attention:</b> if the count argument is larger than the count of the |
116
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
311 | * specified strings, the behavior is undefined. |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
312 | * |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
313 | * @param count the total number of specified strings |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
314 | * @param ... all strings |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
315 | * @return the accumulated length of all strings |
20
db7d9860dbbd
added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
316 | */ |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
317 | size_t scstrnlen(size_t count, ...); |
288
6af5798342e8
makes sstrcat and sstrnlen scstr_t compatible
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
276
diff
changeset
|
318 | |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
319 | /** |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
320 | * Returns the accumulated length of all specified strings. |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
321 | * |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
322 | * <b>Attention:</b> if the count argument is larger than the count of the |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
323 | * specified strings, the behavior is undefined. |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
324 | * |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
325 | * @param count the total number of specified strings |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
326 | * @param ... all strings |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
327 | * @return the cumulated length of all strings |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
328 | */ |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
329 | #define sstrnlen(count, ...) scstrnlen(count, __VA_ARGS__) |
20
db7d9860dbbd
added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
330 | |
119
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
331 | /** |
183
6a694f8f0084
added sstrcat documentation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
180
diff
changeset
|
332 | * Concatenates two or more strings. |
6a694f8f0084
added sstrcat documentation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
180
diff
changeset
|
333 | * |
6a694f8f0084
added sstrcat documentation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
180
diff
changeset
|
334 | * The resulting string will be allocated by standard <code>malloc()</code>. |
6a694f8f0084
added sstrcat documentation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
180
diff
changeset
|
335 | * So developers <b>MUST</b> pass the sstr_t.ptr to <code>free()</code>. |
6a694f8f0084
added sstrcat documentation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
180
diff
changeset
|
336 | * |
6a694f8f0084
added sstrcat documentation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
180
diff
changeset
|
337 | * The sstr_t.ptr of the return value will <i>always</i> be <code>NULL</code>- |
6a694f8f0084
added sstrcat documentation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
180
diff
changeset
|
338 | * terminated. |
180
2185f19dcc45
added new sstrcat
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
179
diff
changeset
|
339 | * |
2185f19dcc45
added new sstrcat
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
179
diff
changeset
|
340 | * @param count the total number of strings to concatenate |
183
6a694f8f0084
added sstrcat documentation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
180
diff
changeset
|
341 | * @param s1 first string |
6a694f8f0084
added sstrcat documentation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
180
diff
changeset
|
342 | * @param ... all remaining strings |
180
2185f19dcc45
added new sstrcat
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
179
diff
changeset
|
343 | * @return the concatenated string |
2185f19dcc45
added new sstrcat
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
179
diff
changeset
|
344 | */ |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
345 | sstr_t scstrcat(size_t count, scstr_t s1, ...); |
288
6af5798342e8
makes sstrcat and sstrnlen scstr_t compatible
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
276
diff
changeset
|
346 | |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
347 | /** |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
348 | * Concatenates two or more strings. |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
349 | * |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
350 | * The resulting string will be allocated by standard <code>malloc()</code>. |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
351 | * So developers <b>MUST</b> pass the sstr_t.ptr to <code>free()</code>. |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
352 | * |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
353 | * The sstr_t.ptr of the return value will <i>always</i> be <code>NULL</code>- |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
354 | * terminated. |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
355 | * |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
356 | * @param count the total number of strings to concatenate |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
357 | * @param s1 first string |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
358 | * @param ... all remaining strings |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
359 | * @return the concatenated string |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
360 | */ |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
361 | #define sstrcat(count, s1, ...) scstrcat(count, SCSTR(s1), __VA_ARGS__) |
183
6a694f8f0084
added sstrcat documentation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
180
diff
changeset
|
362 | |
6a694f8f0084
added sstrcat documentation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
180
diff
changeset
|
363 | /** |
225
a1a068c2c4ef
updates documenting comments
Mike Becker <universe@uap-core.de>
parents:
214
diff
changeset
|
364 | * Concatenates two or more strings using a UcxAllocator. |
183
6a694f8f0084
added sstrcat documentation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
180
diff
changeset
|
365 | * |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
366 | * The resulting string must be freed by the allocators <code>free()</code> |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
367 | * implementation. |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
368 | * |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
369 | * The sstr_t.ptr of the return value will <i>always</i> be <code>NULL</code>- |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
370 | * terminated. |
183
6a694f8f0084
added sstrcat documentation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
180
diff
changeset
|
371 | * |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
372 | * @param alloc the allocator to use |
183
6a694f8f0084
added sstrcat documentation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
180
diff
changeset
|
373 | * @param count the total number of strings to concatenate |
6a694f8f0084
added sstrcat documentation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
180
diff
changeset
|
374 | * @param s1 first string |
6a694f8f0084
added sstrcat documentation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
180
diff
changeset
|
375 | * @param ... all remaining strings |
6a694f8f0084
added sstrcat documentation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
180
diff
changeset
|
376 | * @return the concatenated string |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
377 | * |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
378 | * @see scstrcat() |
183
6a694f8f0084
added sstrcat documentation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
180
diff
changeset
|
379 | */ |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
380 | sstr_t scstrcat_a(UcxAllocator *alloc, size_t count, scstr_t s1, ...); |
180
2185f19dcc45
added new sstrcat
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
179
diff
changeset
|
381 | |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
382 | /** |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
383 | * Concatenates two or more strings using a UcxAllocator. |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
384 | * |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
385 | * The resulting string must be freed by the allocators <code>free()</code> |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
386 | * implementation. |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
387 | * |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
388 | * The sstr_t.ptr of the return value will <i>always</i> be <code>NULL</code>- |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
389 | * terminated. |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
390 | * |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
391 | * @param alloc the allocator to use |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
392 | * @param count the total number of strings to concatenate |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
393 | * @param s1 first string |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
394 | * @param ... all remaining strings |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
395 | * @return the concatenated string |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
396 | * |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
397 | * @see sstrcat() |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
398 | */ |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
399 | #define sstrcat_a(alloc, count, s1, ...) \ |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
400 | scstrcat_a(alloc, count, SCSTR(s1), __VA_ARGS__) |
180
2185f19dcc45
added new sstrcat
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
179
diff
changeset
|
401 | |
2185f19dcc45
added new sstrcat
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
179
diff
changeset
|
402 | /** |
119
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
403 | * Returns a substring starting at the specified location. |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
404 | * |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
405 | * <b>Attention:</b> the new string references the same memory area as the |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
406 | * input string and is <b>NOT</b> required to be <code>NULL</code>-terminated. |
119
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
407 | * Use sstrdup() to get a copy. |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
408 | * |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
409 | * @param string input string |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
410 | * @param start start location of the substring |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
411 | * @return a substring of <code>string</code> starting at <code>start</code> |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
412 | * |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
413 | * @see sstrsubsl() |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
414 | * @see sstrchr() |
20
db7d9860dbbd
added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
415 | */ |
119
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
416 | sstr_t sstrsubs(sstr_t string, size_t start); |
20
db7d9860dbbd
added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
417 | |
119
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
418 | /** |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
419 | * Returns a substring with the given length starting at the specified location. |
119
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
420 | * |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
421 | * <b>Attention:</b> the new string references the same memory area as the |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
422 | * input string and is <b>NOT</b> required to be <code>NULL</code>-terminated. |
119
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
423 | * Use sstrdup() to get a copy. |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
424 | * |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
425 | * @param string input string |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
426 | * @param start start location of the substring |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
427 | * @param length the maximum length of the substring |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
428 | * @return a substring of <code>string</code> starting at <code>start</code> |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
429 | * with a maximum length of <code>length</code> |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
430 | * |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
431 | * @see sstrsubs() |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
432 | * @see sstrchr() |
20
db7d9860dbbd
added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
433 | */ |
119
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
434 | sstr_t sstrsubsl(sstr_t string, size_t start, size_t length); |
20
db7d9860dbbd
added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
435 | |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
436 | /** |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
437 | * Returns a substring of an immutable string starting at the specified |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
438 | * location. |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
439 | * |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
440 | * <b>Attention:</b> the new string references the same memory area as the |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
441 | * input string and is <b>NOT</b> required to be <code>NULL</code>-terminated. |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
442 | * Use scstrdup() to get a copy. |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
443 | * |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
444 | * @param string input string |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
445 | * @param start start location of the substring |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
446 | * @return a substring of <code>string</code> starting at <code>start</code> |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
447 | * |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
448 | * @see scstrsubsl() |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
449 | * @see scstrchr() |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
450 | */ |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
451 | scstr_t scstrsubs(scstr_t string, size_t start); |
300
d1f814633049
completes conversion to scstr
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
288
diff
changeset
|
452 | |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
453 | /** |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
454 | * Returns a substring of an immutable string with a maximum length starting |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
455 | * at the specified location. |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
456 | * |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
457 | * <b>Attention:</b> the new string references the same memory area as the |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
458 | * input string and is <b>NOT</b> required to be <code>NULL</code>-terminated. |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
459 | * Use scstrdup() to get a copy. |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
460 | * |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
461 | * @param string input string |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
462 | * @param start start location of the substring |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
463 | * @param length the maximum length of the substring |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
464 | * @return a substring of <code>string</code> starting at <code>start</code> |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
465 | * with a maximum length of <code>length</code> |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
466 | * |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
467 | * @see scstrsubs() |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
468 | * @see scstrchr() |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
469 | */ |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
470 | scstr_t scstrsubsl(scstr_t string, size_t start, size_t length); |
300
d1f814633049
completes conversion to scstr
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
288
diff
changeset
|
471 | |
119
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
472 | /** |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
473 | * Returns a substring starting at the location of the first occurrence of the |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
474 | * specified character. |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
475 | * |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
476 | * If the string does not contain the character, an empty string is returned. |
108
d2b1e67b2b48
new properties parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
103
diff
changeset
|
477 | * |
119
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
478 | * @param string the string where to locate the character |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
479 | * @param chr the character to locate |
148 | 480 | * @return a substring starting at the first location of <code>chr</code> |
119
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
481 | * |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
482 | * @see sstrsubs() |
108
d2b1e67b2b48
new properties parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
103
diff
changeset
|
483 | */ |
119
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
484 | sstr_t sstrchr(sstr_t string, int chr); |
108
d2b1e67b2b48
new properties parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
103
diff
changeset
|
485 | |
119
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
486 | /** |
148 | 487 | * Returns a substring starting at the location of the last occurrence of the |
488 | * specified character. | |
489 | * | |
490 | * If the string does not contain the character, an empty string is returned. | |
491 | * | |
492 | * @param string the string where to locate the character | |
493 | * @param chr the character to locate | |
494 | * @return a substring starting at the last location of <code>chr</code> | |
495 | * | |
496 | * @see sstrsubs() | |
497 | */ | |
498 | sstr_t sstrrchr(sstr_t string, int chr); | |
499 | ||
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
500 | /** |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
501 | * Returns an immutable substring starting at the location of the first |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
502 | * occurrence of the specified character. |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
503 | * |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
504 | * If the string does not contain the character, an empty string is returned. |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
505 | * |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
506 | * @param string the string where to locate the character |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
507 | * @param chr the character to locate |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
508 | * @return a substring starting at the first location of <code>chr</code> |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
509 | * |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
510 | * @see scstrsubs() |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
511 | */ |
300
d1f814633049
completes conversion to scstr
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
288
diff
changeset
|
512 | scstr_t scstrchr(scstr_t string, int chr); |
d1f814633049
completes conversion to scstr
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
288
diff
changeset
|
513 | |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
514 | /** |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
515 | * Returns an immutable substring starting at the location of the last |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
516 | * occurrence of the specified character. |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
517 | * |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
518 | * If the string does not contain the character, an empty string is returned. |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
519 | * |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
520 | * @param string the string where to locate the character |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
521 | * @param chr the character to locate |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
522 | * @return a substring starting at the last location of <code>chr</code> |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
523 | * |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
524 | * @see scstrsubs() |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
525 | */ |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
526 | scstr_t scstrrchr(scstr_t string, int chr); |
276
f1b2146d4805
adapts sstrtrim, sstrsplit, sstrcmp and sstrstr to new const string API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
275
diff
changeset
|
527 | |
148 | 528 | /** |
214
2bc19726c340
added sstrstr() function + improved sstrsplit variants by using sstrprefix()
Mike Becker <universe@uap-core.de>
parents:
210
diff
changeset
|
529 | * Returns a substring starting at the location of the first occurrence of the |
2bc19726c340
added sstrstr() function + improved sstrsplit variants by using sstrprefix()
Mike Becker <universe@uap-core.de>
parents:
210
diff
changeset
|
530 | * specified string. |
2bc19726c340
added sstrstr() function + improved sstrsplit variants by using sstrprefix()
Mike Becker <universe@uap-core.de>
parents:
210
diff
changeset
|
531 | * |
2bc19726c340
added sstrstr() function + improved sstrsplit variants by using sstrprefix()
Mike Becker <universe@uap-core.de>
parents:
210
diff
changeset
|
532 | * If the string does not contain the other string, an empty string is returned. |
2bc19726c340
added sstrstr() function + improved sstrsplit variants by using sstrprefix()
Mike Becker <universe@uap-core.de>
parents:
210
diff
changeset
|
533 | * |
2bc19726c340
added sstrstr() function + improved sstrsplit variants by using sstrprefix()
Mike Becker <universe@uap-core.de>
parents:
210
diff
changeset
|
534 | * If <code>match</code> is an empty string, the complete <code>string</code> is |
2bc19726c340
added sstrstr() function + improved sstrsplit variants by using sstrprefix()
Mike Becker <universe@uap-core.de>
parents:
210
diff
changeset
|
535 | * returned. |
2bc19726c340
added sstrstr() function + improved sstrsplit variants by using sstrprefix()
Mike Becker <universe@uap-core.de>
parents:
210
diff
changeset
|
536 | * |
2bc19726c340
added sstrstr() function + improved sstrsplit variants by using sstrprefix()
Mike Becker <universe@uap-core.de>
parents:
210
diff
changeset
|
537 | * @param string the string to be scanned |
2bc19726c340
added sstrstr() function + improved sstrsplit variants by using sstrprefix()
Mike Becker <universe@uap-core.de>
parents:
210
diff
changeset
|
538 | * @param match string containing the sequence of characters to match |
2bc19726c340
added sstrstr() function + improved sstrsplit variants by using sstrprefix()
Mike Becker <universe@uap-core.de>
parents:
210
diff
changeset
|
539 | * @return a substring starting at the first occurrence of |
2bc19726c340
added sstrstr() function + improved sstrsplit variants by using sstrprefix()
Mike Becker <universe@uap-core.de>
parents:
210
diff
changeset
|
540 | * <code>match</code>, or an empty string, if the sequence is not |
2bc19726c340
added sstrstr() function + improved sstrsplit variants by using sstrprefix()
Mike Becker <universe@uap-core.de>
parents:
210
diff
changeset
|
541 | * present in <code>string</code> |
2bc19726c340
added sstrstr() function + improved sstrsplit variants by using sstrprefix()
Mike Becker <universe@uap-core.de>
parents:
210
diff
changeset
|
542 | */ |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
543 | sstr_t scstrsstr(sstr_t string, scstr_t match); |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
544 | |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
545 | /** |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
546 | * Returns a substring starting at the location of the first occurrence of the |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
547 | * specified string. |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
548 | * |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
549 | * If the string does not contain the other string, an empty string is returned. |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
550 | * |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
551 | * If <code>match</code> is an empty string, the complete <code>string</code> is |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
552 | * returned. |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
553 | * |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
554 | * @param string the string to be scanned |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
555 | * @param match string containing the sequence of characters to match |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
556 | * @return a substring starting at the first occurrence of |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
557 | * <code>match</code>, or an empty string, if the sequence is not |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
558 | * present in <code>string</code> |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
559 | */ |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
560 | #define sstrstr(string, match) scstrsstr(string, SCSTR(match)) |
276
f1b2146d4805
adapts sstrtrim, sstrsplit, sstrcmp and sstrstr to new const string API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
275
diff
changeset
|
561 | |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
562 | /** |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
563 | * Returns an immutable substring starting at the location of the |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
564 | * first occurrence of the specified immutable string. |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
565 | * |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
566 | * If the string does not contain the other string, an empty string is returned. |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
567 | * |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
568 | * If <code>match</code> is an empty string, the complete <code>string</code> is |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
569 | * returned. |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
570 | * |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
571 | * @param string the string to be scanned |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
572 | * @param match string containing the sequence of characters to match |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
573 | * @return a substring starting at the first occurrence of |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
574 | * <code>match</code>, or an empty string, if the sequence is not |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
575 | * present in <code>string</code> |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
576 | */ |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
577 | scstr_t scstrscstr(scstr_t string, scstr_t match); |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
578 | |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
579 | /** |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
580 | * Returns an immutable substring starting at the location of the |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
581 | * first occurrence of the specified immutable string. |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
582 | * |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
583 | * If the string does not contain the other string, an empty string is returned. |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
584 | * |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
585 | * If <code>match</code> is an empty string, the complete <code>string</code> is |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
586 | * returned. |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
587 | * |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
588 | * @param string the string to be scanned |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
589 | * @param match string containing the sequence of characters to match |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
590 | * @return a substring starting at the first occurrence of |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
591 | * <code>match</code>, or an empty string, if the sequence is not |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
592 | * present in <code>string</code> |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
593 | */ |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
594 | #define sstrscstr(string, match) scstrscstr(string, SCSTR(match)) |
214
2bc19726c340
added sstrstr() function + improved sstrsplit variants by using sstrprefix()
Mike Becker <universe@uap-core.de>
parents:
210
diff
changeset
|
595 | |
2bc19726c340
added sstrstr() function + improved sstrsplit variants by using sstrprefix()
Mike Becker <universe@uap-core.de>
parents:
210
diff
changeset
|
596 | /** |
119
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
597 | * Splits a string into parts by using a delimiter string. |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
598 | * |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
599 | * This function will return <code>NULL</code>, if one of the following happens: |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
600 | * <ul> |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
601 | * <li>the string length is zero</li> |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
602 | * <li>the delimeter length is zero</li> |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
603 | * <li>the string equals the delimeter</li> |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
604 | * <li>memory allocation fails</li> |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
605 | * </ul> |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
606 | * |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
607 | * The integer referenced by <code>count</code> is used as input and determines |
160
302dddaf741d
fixed documentation error in sstr_split
Mike Becker <universe@uap-core.de>
parents:
149
diff
changeset
|
608 | * the maximum size of the resulting array, i.e. the maximum count of splits to |
119
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
609 | * perform + 1. |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
610 | * |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
611 | * The integer referenced by <code>count</code> is also used as output and is |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
612 | * set to |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
613 | * <ul> |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
614 | * <li>-2, on memory allocation errors</li> |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
615 | * <li>-1, if either the string or the delimiter is an empty string</li> |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
616 | * <li>0, if the string equals the delimiter</li> |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
617 | * <li>1, if the string does not contain the delimiter</li> |
160
302dddaf741d
fixed documentation error in sstr_split
Mike Becker <universe@uap-core.de>
parents:
149
diff
changeset
|
618 | * <li>the count of array items, otherwise</li> |
119
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
619 | * </ul> |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
620 | * |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
621 | * If the string starts with the delimiter, the first item of the resulting |
160
302dddaf741d
fixed documentation error in sstr_split
Mike Becker <universe@uap-core.de>
parents:
149
diff
changeset
|
622 | * array will be an empty string. |
119
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
623 | * |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
624 | * If the string ends with the delimiter and the maximum list size is not |
160
302dddaf741d
fixed documentation error in sstr_split
Mike Becker <universe@uap-core.de>
parents:
149
diff
changeset
|
625 | * exceeded, the last array item will be an empty string. |
233
bd58fdde142d
reimplementation of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
225
diff
changeset
|
626 | * In case the list size would be exceeded, the last array item will be the |
bd58fdde142d
reimplementation of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
225
diff
changeset
|
627 | * remaining string after the last split, <i>including</i> the terminating |
bd58fdde142d
reimplementation of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
225
diff
changeset
|
628 | * delimiter. |
119
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
629 | * |
160
302dddaf741d
fixed documentation error in sstr_split
Mike Becker <universe@uap-core.de>
parents:
149
diff
changeset
|
630 | * <b>Attention:</b> The array pointer <b>AND</b> all sstr_t.ptr of the array |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
631 | * items must be manually passed to <code>free()</code>. Use scstrsplit_a() with |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
632 | * an allocator to managed memory, to avoid this. |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
633 | * |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
634 | * @param string the string to split |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
635 | * @param delim the delimiter string |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
636 | * @param count IN: the maximum size of the resulting array (0 = no limit), |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
637 | * OUT: the actual size of the array |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
638 | * @return a sstr_t array containing the split strings or |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
639 | * <code>NULL</code> on error |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
640 | * |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
641 | * @see scstrsplit_a() |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
642 | */ |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
643 | sstr_t* scstrsplit(scstr_t string, scstr_t delim, ssize_t *count); |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
644 | |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
645 | /** |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
646 | * Splits a string into parts by using a delimiter string. |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
647 | * |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
648 | * This function will return <code>NULL</code>, if one of the following happens: |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
649 | * <ul> |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
650 | * <li>the string length is zero</li> |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
651 | * <li>the delimeter length is zero</li> |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
652 | * <li>the string equals the delimeter</li> |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
653 | * <li>memory allocation fails</li> |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
654 | * </ul> |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
655 | * |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
656 | * The integer referenced by <code>count</code> is used as input and determines |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
657 | * the maximum size of the resulting array, i.e. the maximum count of splits to |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
658 | * perform + 1. |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
659 | * |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
660 | * The integer referenced by <code>count</code> is also used as output and is |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
661 | * set to |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
662 | * <ul> |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
663 | * <li>-2, on memory allocation errors</li> |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
664 | * <li>-1, if either the string or the delimiter is an empty string</li> |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
665 | * <li>0, if the string equals the delimiter</li> |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
666 | * <li>1, if the string does not contain the delimiter</li> |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
667 | * <li>the count of array items, otherwise</li> |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
668 | * </ul> |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
669 | * |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
670 | * If the string starts with the delimiter, the first item of the resulting |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
671 | * array will be an empty string. |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
672 | * |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
673 | * If the string ends with the delimiter and the maximum list size is not |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
674 | * exceeded, the last array item will be an empty string. |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
675 | * In case the list size would be exceeded, the last array item will be the |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
676 | * remaining string after the last split, <i>including</i> the terminating |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
677 | * delimiter. |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
678 | * |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
679 | * <b>Attention:</b> The array pointer <b>AND</b> all sstr_t.ptr of the array |
125
fca8efb122de
changed suffix for allocator aware functions + added allocator aware functions for UcxList
Mike Becker <universe@uap-core.de>
parents:
123
diff
changeset
|
680 | * items must be manually passed to <code>free()</code>. Use sstrsplit_a() with |
119
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
681 | * an allocator to managed memory, to avoid this. |
39 | 682 | * |
119
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
683 | * @param string the string to split |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
684 | * @param delim the delimiter string |
160
302dddaf741d
fixed documentation error in sstr_split
Mike Becker <universe@uap-core.de>
parents:
149
diff
changeset
|
685 | * @param count IN: the maximum size of the resulting array (0 = no limit), |
302dddaf741d
fixed documentation error in sstr_split
Mike Becker <universe@uap-core.de>
parents:
149
diff
changeset
|
686 | * OUT: the actual size of the array |
302dddaf741d
fixed documentation error in sstr_split
Mike Becker <universe@uap-core.de>
parents:
149
diff
changeset
|
687 | * @return a sstr_t array containing the split strings or |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
688 | * <code>NULL</code> on error |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
689 | * |
125
fca8efb122de
changed suffix for allocator aware functions + added allocator aware functions for UcxList
Mike Becker <universe@uap-core.de>
parents:
123
diff
changeset
|
690 | * @see sstrsplit_a() |
39 | 691 | */ |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
692 | #define sstrsplit(string, delim, count) \ |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
693 | scstrsplit(SCSTR(string), SCSTR(delim), count) |
119
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
694 | |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
695 | /** |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
696 | * Performing scstrsplit() using a UcxAllocator. |
119
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
697 | * |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
698 | * <i>Read the description of scstrsplit() for details.</i> |
119
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
699 | * |
160
302dddaf741d
fixed documentation error in sstr_split
Mike Becker <universe@uap-core.de>
parents:
149
diff
changeset
|
700 | * The memory for the sstr_t.ptr pointers of the array items and the memory for |
119
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
701 | * the sstr_t array itself are allocated by using the UcxAllocator.malloc() |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
702 | * function. |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
703 | * |
125
fca8efb122de
changed suffix for allocator aware functions + added allocator aware functions for UcxList
Mike Becker <universe@uap-core.de>
parents:
123
diff
changeset
|
704 | * @param allocator the UcxAllocator used for allocating memory |
119
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
705 | * @param string the string to split |
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
706 | * @param delim the delimiter string |
160
302dddaf741d
fixed documentation error in sstr_split
Mike Becker <universe@uap-core.de>
parents:
149
diff
changeset
|
707 | * @param count IN: the maximum size of the resulting array (0 = no limit), |
302dddaf741d
fixed documentation error in sstr_split
Mike Becker <universe@uap-core.de>
parents:
149
diff
changeset
|
708 | * OUT: the actual size of the array |
302dddaf741d
fixed documentation error in sstr_split
Mike Becker <universe@uap-core.de>
parents:
149
diff
changeset
|
709 | * @return a sstr_t array containing the split strings or |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
710 | * <code>NULL</code> on error |
119
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
711 | * |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
712 | * @see scstrsplit() |
119
baa839a7633f
completed documentation on sstr_t + sstrsplit overhaul + allocator version of sstrsplit
Mike Becker <universe@uap-core.de>
parents:
118
diff
changeset
|
713 | */ |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
714 | sstr_t* scstrsplit_a(UcxAllocator *allocator, scstr_t string, scstr_t delim, |
173
31a8682fffb7
fixed some sstring issues + added allocator macros
Mike Becker <universe@uap-core.de>
parents:
160
diff
changeset
|
715 | ssize_t *count); |
20
db7d9860dbbd
added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
716 | |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
717 | /** |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
718 | * Performing sstrsplit() using a UcxAllocator. |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
719 | * |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
720 | * <i>Read the description of sstrsplit() for details.</i> |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
721 | * |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
722 | * The memory for the sstr_t.ptr pointers of the array items and the memory for |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
723 | * the sstr_t array itself are allocated by using the UcxAllocator.malloc() |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
724 | * function. |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
725 | * |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
726 | * @param allocator the UcxAllocator used for allocating memory |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
727 | * @param string the string to split |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
728 | * @param delim the delimiter string |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
729 | * @param count IN: the maximum size of the resulting array (0 = no limit), |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
730 | * OUT: the actual size of the array |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
731 | * @return a sstr_t array containing the split strings or |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
732 | * <code>NULL</code> on error |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
733 | * |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
734 | * @see sstrsplit() |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
735 | */ |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
736 | #define sstrsplit_a(allocator, string, delim, count) \ |
321
9af21a50b516
adds scstr_t to modules.md + fixes parenthesis bug in sstrsplit_a macro
Mike Becker <universe@uap-core.de>
parents:
320
diff
changeset
|
737 | scstrsplit_a(allocator, SCSTR(string), SCSTR(delim), count) |
276
f1b2146d4805
adapts sstrtrim, sstrsplit, sstrcmp and sstrstr to new const string API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
275
diff
changeset
|
738 | |
116
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
739 | /** |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
740 | * Compares two UCX strings with standard <code>memcmp()</code>. |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
741 | * |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
742 | * At first it compares the scstr_t.length attribute of the two strings. The |
116
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
743 | * <code>memcmp()</code> function is called, if and only if the lengths match. |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
744 | * |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
745 | * @param s1 the first string |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
746 | * @param s2 the second string |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
747 | * @return -1, if the length of s1 is less than the length of s2 or 1, if the |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
748 | * length of s1 is greater than the length of s2 or the result of |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
749 | * <code>memcmp()</code> otherwise (i.e. 0 if the strings match) |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
750 | */ |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
751 | int scstrcmp(scstr_t s1, scstr_t s2); |
276
f1b2146d4805
adapts sstrtrim, sstrsplit, sstrcmp and sstrstr to new const string API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
275
diff
changeset
|
752 | |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
753 | /** |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
754 | * Compares two UCX strings with standard <code>memcmp()</code>. |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
755 | * |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
756 | * At first it compares the sstr_t.length attribute of the two strings. The |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
757 | * <code>memcmp()</code> function is called, if and only if the lengths match. |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
758 | * |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
759 | * @param s1 the first string |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
760 | * @param s2 the second string |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
761 | * @return -1, if the length of s1 is less than the length of s2 or 1, if the |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
762 | * length of s1 is greater than the length of s2 or the result of |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
763 | * <code>memcmp()</code> otherwise (i.e. 0 if the strings match) |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
764 | */ |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
765 | #define sstrcmp(s1, s2) scstrcmp(SCSTR(s1), SCSTR(s2)) |
20
db7d9860dbbd
added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
766 | |
116
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
767 | /** |
149 | 768 | * Compares two UCX strings ignoring the case. |
769 | * | |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
770 | * At first it compares the scstr_t.length attribute of the two strings. If and |
149 | 771 | * only if the lengths match, both strings are compared char by char ignoring |
772 | * the case. | |
773 | * | |
774 | * @param s1 the first string | |
775 | * @param s2 the second string | |
776 | * @return -1, if the length of s1 is less than the length of s2 or 1, if the | |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
777 | * length of s1 is greater than the length of s2 or the result of the platform |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
778 | * specific string comparison function ignoring the case. |
149 | 779 | */ |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
780 | int scstrcasecmp(scstr_t s1, scstr_t s2); |
276
f1b2146d4805
adapts sstrtrim, sstrsplit, sstrcmp and sstrstr to new const string API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
275
diff
changeset
|
781 | |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
782 | /** |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
783 | * Compares two UCX strings ignoring the case. |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
784 | * |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
785 | * At first it compares the sstr_t.length attribute of the two strings. If and |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
786 | * only if the lengths match, both strings are compared char by char ignoring |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
787 | * the case. |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
788 | * |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
789 | * @param s1 the first string |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
790 | * @param s2 the second string |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
791 | * @return -1, if the length of s1 is less than the length of s2 or 1, if the |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
792 | * length of s1 is greater than the length of s2 or the result of the platform |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
793 | * specific string comparison function ignoring the case. |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
794 | */ |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
795 | #define sstrcasecmp(s1, s2) scstrcasecmp(SCSTR(s1), SCSTR(s2)) |
149 | 796 | |
797 | /** | |
116
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
798 | * Creates a duplicate of the specified string. |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
799 | * |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
800 | * The new sstr_t will contain a copy allocated by standard |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
801 | * <code>malloc()</code>. So developers <b>MUST</b> pass the sstr_t.ptr to |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
802 | * <code>free()</code>. |
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
803 | * |
118
151f5345f303
documented allocator + some further documentation for sstr_t
Mike Becker <universe@uap-core.de>
parents:
116
diff
changeset
|
804 | * The sstr_t.ptr of the return value will <i>always</i> be <code>NULL</code>- |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
805 | * terminated and mutable, regardless of the argument. |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
806 | * |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
807 | * @param string the string to duplicate |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
808 | * @return a duplicate of the string |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
809 | * @see scstrdup_a() |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
810 | */ |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
811 | sstr_t scstrdup(scstr_t string); |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
812 | |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
813 | /** |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
814 | * Creates a duplicate of the specified string. |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
815 | * |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
816 | * The new sstr_t will contain a copy allocated by standard |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
817 | * <code>malloc()</code>. So developers <b>MUST</b> pass the sstr_t.ptr to |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
818 | * <code>free()</code>. |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
819 | * |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
820 | * The sstr_t.ptr of the return value will <i>always</i> be <code>NULL</code>- |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
821 | * terminated, regardless of the argument. |
118
151f5345f303
documented allocator + some further documentation for sstr_t
Mike Becker <universe@uap-core.de>
parents:
116
diff
changeset
|
822 | * |
116
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
823 | * @param string the string to duplicate |
118
151f5345f303
documented allocator + some further documentation for sstr_t
Mike Becker <universe@uap-core.de>
parents:
116
diff
changeset
|
824 | * @return a duplicate of the string |
125
fca8efb122de
changed suffix for allocator aware functions + added allocator aware functions for UcxList
Mike Becker <universe@uap-core.de>
parents:
123
diff
changeset
|
825 | * @see sstrdup_a() |
116
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
826 | */ |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
827 | #define sstrdup(string) scstrdup(SCSTR(string)) |
118
151f5345f303
documented allocator + some further documentation for sstr_t
Mike Becker <universe@uap-core.de>
parents:
116
diff
changeset
|
828 | |
151f5345f303
documented allocator + some further documentation for sstr_t
Mike Becker <universe@uap-core.de>
parents:
116
diff
changeset
|
829 | /** |
225
a1a068c2c4ef
updates documenting comments
Mike Becker <universe@uap-core.de>
parents:
214
diff
changeset
|
830 | * Creates a duplicate of the specified string using a UcxAllocator. |
118
151f5345f303
documented allocator + some further documentation for sstr_t
Mike Becker <universe@uap-core.de>
parents:
116
diff
changeset
|
831 | * |
151f5345f303
documented allocator + some further documentation for sstr_t
Mike Becker <universe@uap-core.de>
parents:
116
diff
changeset
|
832 | * The new sstr_t will contain a copy allocated by the allocators |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
833 | * UcxAllocator.malloc() function. So it is implementation depended, whether the |
118
151f5345f303
documented allocator + some further documentation for sstr_t
Mike Becker <universe@uap-core.de>
parents:
116
diff
changeset
|
834 | * returned sstr_t.ptr pointer must be passed to the allocators |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
835 | * UcxAllocator.free() function manually. |
118
151f5345f303
documented allocator + some further documentation for sstr_t
Mike Becker <universe@uap-core.de>
parents:
116
diff
changeset
|
836 | * |
151f5345f303
documented allocator + some further documentation for sstr_t
Mike Becker <universe@uap-core.de>
parents:
116
diff
changeset
|
837 | * The sstr_t.ptr of the return value will <i>always</i> be <code>NULL</code>- |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
838 | * terminated and mutable, regardless of the argument. |
118
151f5345f303
documented allocator + some further documentation for sstr_t
Mike Becker <universe@uap-core.de>
parents:
116
diff
changeset
|
839 | * |
225
a1a068c2c4ef
updates documenting comments
Mike Becker <universe@uap-core.de>
parents:
214
diff
changeset
|
840 | * @param allocator a valid instance of a UcxAllocator |
118
151f5345f303
documented allocator + some further documentation for sstr_t
Mike Becker <universe@uap-core.de>
parents:
116
diff
changeset
|
841 | * @param string the string to duplicate |
151f5345f303
documented allocator + some further documentation for sstr_t
Mike Becker <universe@uap-core.de>
parents:
116
diff
changeset
|
842 | * @return a duplicate of the string |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
843 | * @see scstrdup() |
118
151f5345f303
documented allocator + some further documentation for sstr_t
Mike Becker <universe@uap-core.de>
parents:
116
diff
changeset
|
844 | */ |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
845 | sstr_t scstrdup_a(UcxAllocator *allocator, scstr_t string); |
275
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
846 | |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
847 | /** |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
848 | * Creates a duplicate of the specified string using a UcxAllocator. |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
849 | * |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
850 | * The new sstr_t will contain a copy allocated by the allocators |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
851 | * UcxAllocator.malloc() function. So it is implementation depended, whether the |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
852 | * returned sstr_t.ptr pointer must be passed to the allocators |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
853 | * UcxAllocator.free() function manually. |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
854 | * |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
855 | * The sstr_t.ptr of the return value will <i>always</i> be <code>NULL</code>- |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
856 | * terminated, regardless of the argument. |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
857 | * |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
858 | * @param allocator a valid instance of a UcxAllocator |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
859 | * @param string the string to duplicate |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
860 | * @return a duplicate of the string |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
861 | * @see scstrdup() |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
862 | */ |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
863 | #define sstrdup_a(allocator, string) scstrdup_a(allocator, SCSTR(string)) |
20
db7d9860dbbd
added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
864 | |
276
f1b2146d4805
adapts sstrtrim, sstrsplit, sstrcmp and sstrstr to new const string API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
275
diff
changeset
|
865 | |
118
151f5345f303
documented allocator + some further documentation for sstr_t
Mike Becker <universe@uap-core.de>
parents:
116
diff
changeset
|
866 | /** |
151f5345f303
documented allocator + some further documentation for sstr_t
Mike Becker <universe@uap-core.de>
parents:
116
diff
changeset
|
867 | * Omits leading and trailing spaces. |
151f5345f303
documented allocator + some further documentation for sstr_t
Mike Becker <universe@uap-core.de>
parents:
116
diff
changeset
|
868 | * |
151f5345f303
documented allocator + some further documentation for sstr_t
Mike Becker <universe@uap-core.de>
parents:
116
diff
changeset
|
869 | * This function returns a new sstr_t containing a trimmed version of the |
151f5345f303
documented allocator + some further documentation for sstr_t
Mike Becker <universe@uap-core.de>
parents:
116
diff
changeset
|
870 | * specified string. |
151f5345f303
documented allocator + some further documentation for sstr_t
Mike Becker <universe@uap-core.de>
parents:
116
diff
changeset
|
871 | * |
151f5345f303
documented allocator + some further documentation for sstr_t
Mike Becker <universe@uap-core.de>
parents:
116
diff
changeset
|
872 | * <b>Note:</b> the new sstr_t references the same memory, thus you |
151f5345f303
documented allocator + some further documentation for sstr_t
Mike Becker <universe@uap-core.de>
parents:
116
diff
changeset
|
873 | * <b>MUST NOT</b> pass the sstr_t.ptr of the return value to |
151f5345f303
documented allocator + some further documentation for sstr_t
Mike Becker <universe@uap-core.de>
parents:
116
diff
changeset
|
874 | * <code>free()</code>. It is also highly recommended to avoid assignments like |
151f5345f303
documented allocator + some further documentation for sstr_t
Mike Becker <universe@uap-core.de>
parents:
116
diff
changeset
|
875 | * <code>mystr = sstrtrim(mystr);</code> as you lose the reference to the |
151f5345f303
documented allocator + some further documentation for sstr_t
Mike Becker <universe@uap-core.de>
parents:
116
diff
changeset
|
876 | * source string. Assignments of this type are only permitted, if the |
151f5345f303
documented allocator + some further documentation for sstr_t
Mike Becker <universe@uap-core.de>
parents:
116
diff
changeset
|
877 | * sstr_t.ptr of the source string does not need to be freed or if another |
151f5345f303
documented allocator + some further documentation for sstr_t
Mike Becker <universe@uap-core.de>
parents:
116
diff
changeset
|
878 | * reference to the source string exists. |
151f5345f303
documented allocator + some further documentation for sstr_t
Mike Becker <universe@uap-core.de>
parents:
116
diff
changeset
|
879 | * |
151f5345f303
documented allocator + some further documentation for sstr_t
Mike Becker <universe@uap-core.de>
parents:
116
diff
changeset
|
880 | * @param string the string that shall be trimmed |
151f5345f303
documented allocator + some further documentation for sstr_t
Mike Becker <universe@uap-core.de>
parents:
116
diff
changeset
|
881 | * @return a new sstr_t containing the trimmed string |
151f5345f303
documented allocator + some further documentation for sstr_t
Mike Becker <universe@uap-core.de>
parents:
116
diff
changeset
|
882 | */ |
96 | 883 | sstr_t sstrtrim(sstr_t string); |
884 | ||
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
885 | /** |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
886 | * Omits leading and trailing spaces. |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
887 | * |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
888 | * This function returns a new scstr_t containing a trimmed version of the |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
889 | * specified string. |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
890 | * |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
891 | * <b>Note:</b> the new scstr_t references the same memory, thus you |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
892 | * <b>MUST NOT</b> pass the scstr_t.ptr of the return value to |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
893 | * <code>free()</code>. It is also highly recommended to avoid assignments like |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
894 | * <code>mystr = scstrtrim(mystr);</code> as you lose the reference to the |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
895 | * source string. Assignments of this type are only permitted, if the |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
896 | * scstr_t.ptr of the source string does not need to be freed or if another |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
897 | * reference to the source string exists. |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
898 | * |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
899 | * @param string the string that shall be trimmed |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
900 | * @return a new scstr_t containing the trimmed string |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
901 | */ |
276
f1b2146d4805
adapts sstrtrim, sstrsplit, sstrcmp and sstrstr to new const string API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
275
diff
changeset
|
902 | scstr_t scstrtrim(scstr_t string); |
f1b2146d4805
adapts sstrtrim, sstrsplit, sstrcmp and sstrstr to new const string API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
275
diff
changeset
|
903 | |
146
aa376dba1ba8
fixed documentation for netbeans parser + added sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
125
diff
changeset
|
904 | /** |
aa376dba1ba8
fixed documentation for netbeans parser + added sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
125
diff
changeset
|
905 | * Checks, if a string has a specific prefix. |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
906 | * |
146
aa376dba1ba8
fixed documentation for netbeans parser + added sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
125
diff
changeset
|
907 | * @param string the string to check |
aa376dba1ba8
fixed documentation for netbeans parser + added sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
125
diff
changeset
|
908 | * @param prefix the prefix the string should have |
aa376dba1ba8
fixed documentation for netbeans parser + added sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
125
diff
changeset
|
909 | * @return 1, if and only if the string has the specified prefix, 0 otherwise |
aa376dba1ba8
fixed documentation for netbeans parser + added sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
125
diff
changeset
|
910 | */ |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
911 | int scstrprefix(scstr_t string, scstr_t prefix); |
275
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
912 | |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
913 | /** |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
914 | * Checks, if a string has a specific prefix. |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
915 | * |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
916 | * @param string the string to check |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
917 | * @param prefix the prefix the string should have |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
918 | * @return 1, if and only if the string has the specified prefix, 0 otherwise |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
919 | */ |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
920 | #define sstrprefix(string, prefix) scstrprefix(SCSTR(string), SCSTR(prefix)) |
146
aa376dba1ba8
fixed documentation for netbeans parser + added sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
125
diff
changeset
|
921 | |
aa376dba1ba8
fixed documentation for netbeans parser + added sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
125
diff
changeset
|
922 | /** |
aa376dba1ba8
fixed documentation for netbeans parser + added sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
125
diff
changeset
|
923 | * Checks, if a string has a specific suffix. |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
924 | * |
146
aa376dba1ba8
fixed documentation for netbeans parser + added sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
125
diff
changeset
|
925 | * @param string the string to check |
aa376dba1ba8
fixed documentation for netbeans parser + added sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
125
diff
changeset
|
926 | * @param suffix the suffix the string should have |
aa376dba1ba8
fixed documentation for netbeans parser + added sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
125
diff
changeset
|
927 | * @return 1, if and only if the string has the specified suffix, 0 otherwise |
aa376dba1ba8
fixed documentation for netbeans parser + added sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
125
diff
changeset
|
928 | */ |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
929 | int scstrsuffix(scstr_t string, scstr_t suffix); |
275
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
930 | |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
931 | /** |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
932 | * Checks, if a string has a specific suffix. |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
933 | * |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
934 | * @param string the string to check |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
935 | * @param suffix the suffix the string should have |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
936 | * @return 1, if and only if the string has the specified suffix, 0 otherwise |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
937 | */ |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
938 | #define sstrsuffix(string, suffix) scstrsuffix(SCSTR(string), SCSTR(suffix)) |
146
aa376dba1ba8
fixed documentation for netbeans parser + added sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
125
diff
changeset
|
939 | |
210
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
940 | /** |
364
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
941 | * Checks, if a string has a specific prefix, ignoring the case. |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
942 | * |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
943 | * @param string the string to check |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
944 | * @param prefix the prefix the string should have |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
945 | * @return 1, if and only if the string has the specified prefix, 0 otherwise |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
946 | */ |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
947 | int scstrcaseprefix(scstr_t string, scstr_t prefix); |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
948 | |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
949 | /** |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
950 | * Checks, if a string has a specific prefix, ignoring the case. |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
951 | * |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
952 | * @param string the string to check |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
953 | * @param prefix the prefix the string should have |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
954 | * @return 1, if and only if the string has the specified prefix, 0 otherwise |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
955 | */ |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
956 | #define sstrcaseprefix(string, prefix) \ |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
957 | scstrcaseprefix(SCSTR(string), SCSTR(prefix)) |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
958 | |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
959 | /** |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
960 | * Checks, if a string has a specific suffix, ignoring the case. |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
961 | * |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
962 | * @param string the string to check |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
963 | * @param suffix the suffix the string should have |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
964 | * @return 1, if and only if the string has the specified suffix, 0 otherwise |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
965 | */ |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
966 | int scstrcasesuffix(scstr_t string, scstr_t suffix); |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
967 | |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
968 | /** |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
969 | * Checks, if a string has a specific suffix, ignoring the case. |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
970 | * |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
971 | * @param string the string to check |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
972 | * @param suffix the suffix the string should have |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
973 | * @return 1, if and only if the string has the specified suffix, 0 otherwise |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
974 | */ |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
975 | #define sstrcasesuffix(string, suffix) \ |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
976 | scstrcasesuffix(SCSTR(string), SCSTR(suffix)) |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
977 | |
5577d6c27a33
adds case independent versions of sstrprefix() and sstrsuffix()
Mike Becker <universe@uap-core.de>
parents:
363
diff
changeset
|
978 | /** |
210
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
979 | * Returns a lower case version of a string. |
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
980 | * |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
981 | * This function creates a duplicate of the input string, first |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
982 | * (see scstrdup()). |
210
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
983 | * |
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
984 | * @param string the input string |
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
985 | * @return the resulting lower case string |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
986 | * @see scstrdup() |
210
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
987 | */ |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
988 | sstr_t scstrlower(scstr_t string); |
275
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
989 | |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
990 | /** |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
991 | * Returns a lower case version of a string. |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
992 | * |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
993 | * This function creates a duplicate of the input string, first |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
994 | * (see sstrdup()). |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
995 | * |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
996 | * @param string the input string |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
997 | * @return the resulting lower case string |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
998 | */ |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
999 | #define sstrlower(string) scstrlower(SCSTR(string)) |
210
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
1000 | |
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
1001 | /** |
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
1002 | * Returns a lower case version of a string. |
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
1003 | * |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
1004 | * This function creates a duplicate of the input string, first |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
1005 | * (see scstrdup_a()). |
210
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
1006 | * |
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
1007 | * @param allocator the allocator used for duplicating the string |
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
1008 | * @param string the input string |
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
1009 | * @return the resulting lower case string |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
1010 | * @see scstrdup_a() |
210
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
1011 | */ |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
1012 | sstr_t scstrlower_a(UcxAllocator *allocator, scstr_t string); |
275
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
1013 | |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
1014 | |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
1015 | /** |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
1016 | * Returns a lower case version of a string. |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
1017 | * |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
1018 | * This function creates a duplicate of the input string, first |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
1019 | * (see sstrdup_a()). |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
1020 | * |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
1021 | * @param allocator the allocator used for duplicating the string |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
1022 | * @param string the input string |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
1023 | * @return the resulting lower case string |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
1024 | */ |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
1025 | #define sstrlower_a(allocator, string) scstrlower_a(allocator, SCSTR(string)) |
210
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
1026 | |
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
1027 | /** |
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
1028 | * Returns a upper case version of a string. |
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
1029 | * |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
1030 | * This function creates a duplicate of the input string, first |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
1031 | * (see scstrdup()). |
210
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
1032 | * |
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
1033 | * @param string the input string |
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
1034 | * @return the resulting upper case string |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
1035 | * @see scstrdup() |
210
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
1036 | */ |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
1037 | sstr_t scstrupper(scstr_t string); |
275
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
1038 | |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
1039 | /** |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
1040 | * Returns a upper case version of a string. |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
1041 | * |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
1042 | * This function creates a duplicate of the input string, first |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
1043 | * (see sstrdup()). |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
1044 | * |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
1045 | * @param string the input string |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
1046 | * @return the resulting upper case string |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
1047 | */ |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
1048 | #define sstrupper(string) scstrupper(SCSTR(string)) |
210
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
1049 | |
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
1050 | /** |
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
1051 | * Returns a upper case version of a string. |
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
1052 | * |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
1053 | * This function creates a duplicate of the input string, first |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
1054 | * (see scstrdup_a()). |
210
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
1055 | * |
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
1056 | * @param allocator the allocator used for duplicating the string |
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
1057 | * @param string the input string |
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
1058 | * @return the resulting upper case string |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
1059 | * @see scstrdup_a() |
210
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
1060 | */ |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
1061 | sstr_t scstrupper_a(UcxAllocator *allocator, scstr_t string); |
275
96f643d30ff1
adds scstr_t struct for const strings and adapts some string functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
1062 | |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
1063 | /** |
363
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
1064 | * Returns a upper case version of a string. |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
1065 | * |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
1066 | * This function creates a duplicate of the input string, first |
8175ba2b3bcb
fixes hard to use documentation in string.h
Mike Becker <universe@uap-core.de>
parents:
328
diff
changeset
|
1067 | * (see sstrdup_a()). |
318
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
1068 | * |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
1069 | * @param allocator the allocator used for duplicating the string |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
1070 | * @param string the input string |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
1071 | * @return the resulting upper case string |
348fd9cb7b14
adds remaining documentation for the scstr functions
Mike Becker <universe@uap-core.de>
parents:
316
diff
changeset
|
1072 | */ |
319
0380e438a7ce
unifies naming of sstr_t related and scstr_t related functions
Mike Becker <universe@uap-core.de>
parents:
318
diff
changeset
|
1073 | #define sstrupper_a(allocator, string) scstrupper_a(allocator, string) |
210
6bdb04d87236
added sstrlower / sstrupper variants
Mike Becker <universe@uap-core.de>
parents:
192
diff
changeset
|
1074 | |
378
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1075 | |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1076 | /** |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1077 | * Replaces a pattern in a string with another string. |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1078 | * |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1079 | * The pattern is taken literally and is no regular expression. |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1080 | * Replaces at most <code>replmax</code> occurrences. |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1081 | * |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1082 | * The resulting string is allocated by the specified allocator. I.e. it |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1083 | * depends on the used allocator, whether the sstr_t.ptr must be freed |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1084 | * manually. |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1085 | * |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1086 | * If allocation fails, the sstr_t.ptr of the return value is NULL. |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1087 | * |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1088 | * @param allocator the allocator to use |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1089 | * @param str the string where replacements should be applied |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1090 | * @param pattern the pattern to search for |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1091 | * @param replacement the replacement string |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1092 | * @param replmax maximum number of replacements |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1093 | * @return the resulting string after applying the replacements |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1094 | */ |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1095 | sstr_t scstrreplacen_a(UcxAllocator *allocator, scstr_t str, |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1096 | scstr_t pattern, scstr_t replacement, size_t replmax); |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1097 | |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1098 | /** |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1099 | * Replaces a pattern in a string with another string. |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1100 | * |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1101 | * The pattern is taken literally and is no regular expression. |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1102 | * Replaces at most <code>replmax</code> occurrences. |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1103 | * |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1104 | * The sstr_t.ptr of the resulting string must be freed manually. |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1105 | * |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1106 | * If allocation fails, the sstr_t.ptr of the return value is NULL. |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1107 | * |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1108 | * @param str the string where replacements should be applied |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1109 | * @param pattern the pattern to search for |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1110 | * @param replacement the replacement string |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1111 | * @param replmax maximum number of replacements |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1112 | * @return the resulting string after applying the replacements |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1113 | */ |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1114 | sstr_t scstrreplacen(scstr_t str, scstr_t pattern, |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1115 | scstr_t replacement, size_t replmax); |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1116 | |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1117 | /** |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1118 | * Replaces a pattern in a string with another string. |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1119 | * |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1120 | * The pattern is taken literally and is no regular expression. |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1121 | * Replaces at most <code>replmax</code> occurrences. |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1122 | * |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1123 | * The resulting string is allocated by the specified allocator. I.e. it |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1124 | * depends on the used allocator, whether the sstr_t.ptr must be freed |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1125 | * manually. |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1126 | * |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1127 | * @param allocator the allocator to use |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1128 | * @param str the string where replacements should be applied |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1129 | * @param pattern the pattern to search for |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1130 | * @param replacement the replacement string |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1131 | * @param replmax maximum number of replacements |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1132 | * @return the resulting string after applying the replacements |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1133 | */ |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1134 | #define sstrreplacen_a(allocator, str, pattern, replacement, replmax) \ |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1135 | scstrreplacen_a(allocator, SCSTR(str), SCSTR(pattern), \ |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1136 | SCSTR(replacement), replmax) |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1137 | |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1138 | /** |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1139 | * Replaces a pattern in a string with another string. |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1140 | * |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1141 | * The pattern is taken literally and is no regular expression. |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1142 | * Replaces at most <code>replmax</code> occurrences. |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1143 | * |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1144 | * The sstr_t.ptr of the resulting string must be freed manually. |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1145 | * |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1146 | * If allocation fails, the sstr_t.ptr of the return value is NULL. |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1147 | * |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1148 | * @param str the string where replacements should be applied |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1149 | * @param pattern the pattern to search for |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1150 | * @param replacement the replacement string |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1151 | * @param replmax maximum number of replacements |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1152 | * @return the resulting string after applying the replacements |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1153 | */ |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1154 | #define sstrreplacen(str, pattern, replacement, replmax) \ |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1155 | scstrreplacen(SCSTR(str), SCSTR(pattern), SCSTR(replacement), replmax) |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1156 | |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1157 | /** |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1158 | * Replaces a pattern in a string with another string. |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1159 | * |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1160 | * The pattern is taken literally and is no regular expression. |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1161 | * Replaces at most <code>replmax</code> occurrences. |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1162 | * |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1163 | * The resulting string is allocated by the specified allocator. I.e. it |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1164 | * depends on the used allocator, whether the sstr_t.ptr must be freed |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1165 | * manually. |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1166 | * |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1167 | * If allocation fails, the sstr_t.ptr of the return value is NULL. |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1168 | * |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1169 | * @param allocator the allocator to use |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1170 | * @param str the string where replacements should be applied |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1171 | * @param pattern the pattern to search for |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1172 | * @param replacement the replacement string |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1173 | * @return the resulting string after applying the replacements |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1174 | */ |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1175 | #define sstrreplace_a(allocator, str, pattern, replacement) \ |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1176 | scstrreplacen_a(allocator, SCSTR(str), SCSTR(pattern), \ |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1177 | SCSTR(replacement), SIZE_MAX) |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1178 | |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1179 | /** |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1180 | * Replaces a pattern in a string with another string. |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1181 | * |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1182 | * The pattern is taken literally and is no regular expression. |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1183 | * Replaces at most <code>replmax</code> occurrences. |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1184 | * |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1185 | * The sstr_t.ptr of the resulting string must be freed manually. |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1186 | * |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1187 | * If allocation fails, the sstr_t.ptr of the return value is NULL. |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1188 | * |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1189 | * @param str the string where replacements should be applied |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1190 | * @param pattern the pattern to search for |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1191 | * @param replacement the replacement string |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1192 | * @return the resulting string after applying the replacements |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1193 | */ |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1194 | #define sstrreplace(str, pattern, replacement) \ |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1195 | scstrreplacen(SCSTR(str), SCSTR(pattern), SCSTR(replacement), SIZE_MAX) |
952c2df7e7ac
adds string replace functions
Mike Becker <universe@uap-core.de>
parents:
364
diff
changeset
|
1196 | |
20
db7d9860dbbd
added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1197 | #ifdef __cplusplus |
db7d9860dbbd
added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1198 | } |
db7d9860dbbd
added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1199 | #endif |
db7d9860dbbd
added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1200 | |
116
234920008754
some fixes and some documentation
Mike Becker <universe@uap-core.de>
parents:
109
diff
changeset
|
1201 | #endif /* UCX_STRING_H */ |