ucx/string.h

changeset 39
3e55bed345f9
parent 17
11dffb40cd91
child 70
88092b88ec00
equal deleted inserted replaced
38:b855f76e965b 39:3e55bed345f9
193 * 193 *
194 * If the string does not contain the character, an empty string is returned. 194 * If the string does not contain the character, an empty string is returned.
195 * 195 *
196 * @param string the string where to locate the character 196 * @param string the string where to locate the character
197 * @param chr the character to locate 197 * @param chr the character to locate
198 * @return a substring starting at the least location of <code>chr</code> 198 * @return a substring starting at the first location of <code>chr</code>
199 * 199 *
200 * @see sstrsubs() 200 * @see sstrsubs()
201 */ 201 */
202 sstr_t sstrchr(sstr_t string, int chr); 202 sstr_t sstrchr(sstr_t string, int chr);
203
204 /**
205 * Returns a substring starting at the location of the last occurrence of the
206 * specified character.
207 *
208 * If the string does not contain the character, an empty string is returned.
209 *
210 * @param string the string where to locate the character
211 * @param chr the character to locate
212 * @return a substring starting at the last location of <code>chr</code>
213 *
214 * @see sstrsubs()
215 */
216 sstr_t sstrrchr(sstr_t string, int chr);
203 217
204 /** 218 /**
205 * Splits a string into parts by using a delimiter string. 219 * Splits a string into parts by using a delimiter string.
206 * 220 *
207 * This function will return <code>NULL</code>, if one of the following happens: 221 * This function will return <code>NULL</code>, if one of the following happens:
285 * <code>memcmp()</code> otherwise (i.e. 0 if the strings match) 299 * <code>memcmp()</code> otherwise (i.e. 0 if the strings match)
286 */ 300 */
287 int sstrcmp(sstr_t s1, sstr_t s2); 301 int sstrcmp(sstr_t s1, sstr_t s2);
288 302
289 /** 303 /**
304 * Compares two UCX strings ignoring the case.
305 *
306 * At first it compares the sstr_t.length attribute of the two strings. If and
307 * only if the lengths match, both strings are compared char by char ignoring
308 * the case.
309 *
310 * @param s1 the first string
311 * @param s2 the second string
312 * @return -1, if the length of s1 is less than the length of s2 or 1, if the
313 * length of s1 is greater than the length of s2 or the difference between the
314 * first two differing characters otherwise (i.e. 0 if the strings match and
315 * no characters differ)
316 */
317 int sstrcasecmp(sstr_t s1, sstr_t s2);
318
319 /**
290 * Creates a duplicate of the specified string. 320 * Creates a duplicate of the specified string.
291 * 321 *
292 * The new sstr_t will contain a copy allocated by standard 322 * The new sstr_t will contain a copy allocated by standard
293 * <code>malloc()</code>. So developers <b>MUST</b> pass the sstr_t.ptr to 323 * <code>malloc()</code>. So developers <b>MUST</b> pass the sstr_t.ptr to
294 * <code>free()</code>. 324 * <code>free()</code>.

mercurial