ucx/string.h

changeset 68
88dbea299440
parent 67
27e67e725d35
child 69
fb59270b1de3
equal deleted inserted replaced
67:27e67e725d35 68:88dbea299440
26 /* 26 /*
27 * creates a new sstr_t from a null terminated string 27 * creates a new sstr_t from a null terminated string
28 * 28 *
29 * s null terminated string 29 * s null terminated string
30 */ 30 */
31 sstr_t sstr (char *s); 31 sstr_t sstr(char *s);
32 32
33 /* 33 /*
34 * creates a new sstr_t from a string and length 34 * creates a new sstr_t from a string and length
35 * 35 *
36 * s string 36 * s string
37 * n length of string 37 * n length of string
38 */ 38 */
39 sstr_t sstrn (char *s, size_t n); 39 sstr_t sstrn(char *s, size_t n);
40 40
41 41
42 /* 42 /*
43 * gets the length of n sstr_t strings 43 * gets the length of n sstr_t strings
44 * 44 *
45 * n number of strings 45 * n number of strings
46 * s string 46 * s string
47 * ... strings 47 * ... strings
48 */ 48 */
49 size_t sstrnlen (size_t n, const sstr_t s, ...); 49 size_t sstrnlen(size_t n, sstr_t s, ...);
50 50
51 51
52 /* 52 /*
53 * concatenates n strings 53 * concatenates n strings
54 * 54 *
55 * n number of strings 55 * n number of strings
56 * s new string with enough memory allocated 56 * s new string with enough memory allocated
57 * ... strings 57 * ... strings
58 */ 58 */
59 sstr_t sstrncat (size_t n, sstr_t s, const sstr_t c1, ...); 59 sstr_t sstrncat(size_t n, sstr_t s, sstr_t c1, ...);
60 60
61 61
62 /* 62 /*
63 * 63 *
64 */ 64 */
65 sstr_t sstrsubs (const sstr_t s, size_t start); 65 sstr_t sstrsubs(sstr_t s, size_t start);
66 66
67 /* 67 /*
68 * 68 *
69 */ 69 */
70 sstr_t sstrsubsl (const sstr_t s, size_t start, size_t length); 70 sstr_t sstrsubsl(sstr_t s, size_t start, size_t length);
71 71
72 /* 72 /*
73 * splits s into n parts 73 * splits s into n parts
74 * 74 *
75 * s the string to split 75 * s the string to split
83 * Returns a list of the split strings 83 * Returns a list of the split strings
84 * NOTE: this list needs to be freed manually after usage 84 * NOTE: this list needs to be freed manually after usage
85 * 85 *
86 * Returns NULL on error 86 * Returns NULL on error
87 */ 87 */
88 sstr_t* sstrsplit(const sstr_t s, const sstr_t d, size_t *n); 88 sstr_t* sstrsplit(sstr_t s, sstr_t d, size_t *n);
89 89
90 int sstrcmp(const sstr_t s1, const sstr_t s2); 90 int sstrcmp(sstr_t s1, sstr_t s2);
91 91
92 sstr_t sstrdup(const sstr_t s); 92 sstr_t sstrdup(sstr_t s);
93 93
94 #ifdef __cplusplus 94 #ifdef __cplusplus
95 } 95 }
96 #endif 96 #endif
97 97

mercurial