diff -r d7c4ba50b7d8 -r bf19378aed58 ucx/string.h --- a/ucx/string.h Fri Nov 18 13:39:20 2016 +0100 +++ b/ucx/string.h Fri Nov 18 15:27:45 2016 +0100 @@ -1,7 +1,7 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright 2015 Olaf Wintermann. All rights reserved. + * Copyright 2016 Olaf Wintermann. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -137,7 +137,7 @@ sstr_t sstrcat(size_t count, sstr_t s1, sstr_t s2, ...); /** - * Concatenates two or more strings using an UcxAllocator. + * Concatenates two or more strings using a UcxAllocator. * * See sstrcat() for details. * @@ -214,6 +214,23 @@ sstr_t sstrrchr(sstr_t string, int chr); /** + * Returns a substring starting at the location of the first occurrence of the + * specified string. + * + * If the string does not contain the other string, an empty string is returned. + * + * If match is an empty string, the complete string is + * returned. + * + * @param string the string to be scanned + * @param match string containing the sequence of characters to match + * @return a substring starting at the first occurrence of + * match, or an empty string, if the sequence is not + * present in string + */ +sstr_t sstrstr(sstr_t string, sstr_t match); + +/** * Splits a string into parts by using a delimiter string. * * This function will return NULL, if one of the following happens: @@ -260,7 +277,7 @@ sstr_t* sstrsplit(sstr_t string, sstr_t delim, ssize_t *count); /** - * Performing sstrsplit() using an UcxAllocator. + * Performing sstrsplit() using a UcxAllocator. * * Read the description of sstrsplit() for details. * @@ -331,7 +348,7 @@ sstr_t sstrdup(sstr_t string); /** - * Creates a duplicate of the specified string using an UcxAllocator. + * Creates a duplicate of the specified string using a UcxAllocator. * * The new sstr_t will contain a copy allocated by the allocators * ucx_allocator_malloc function. So it is implementation depended, whether the @@ -341,7 +358,7 @@ * The sstr_t.ptr of the return value will always be NULL- * terminated. * - * @param allocator a valid instance of an UcxAllocator + * @param allocator a valid instance of a UcxAllocator * @param string the string to duplicate * @return a duplicate of the string * @see sstrdup()