ucx/string.h

changeset 255
bf19378aed58
parent 174
e7e56c56d126
child 314
8722a668fb2a
--- 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 <code>match</code> is an empty string, the complete <code>string</code> 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
+ *               <code>match</code>, or an empty string, if the sequence is not
+ *               present in <code>string</code>
+ */
+sstr_t sstrstr(sstr_t string, sstr_t match);
+
+/**
  * Splits a string into parts by using a delimiter string.
  * 
  * This function will return <code>NULL</code>, 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.
  * 
  * <i>Read the description of sstrsplit() for details.</i>
  * 
@@ -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 <i>always</i> be <code>NULL</code>-
  * 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()

mercurial