src/cx/string.h

changeset 1221
304f4f7b37d1
parent 1193
cfa44f3f5e3b
--- a/src/cx/string.h	Fri Feb 21 21:06:07 2025 +0100
+++ b/src/cx/string.h	Sat Feb 22 18:55:25 2025 +0100
@@ -983,9 +983,8 @@
 );
 
 /**
- * Replaces a pattern in a string with another string.
+ * Replaces a string with another string.
  *
- * The pattern is taken literally and is no regular expression.
  * Replaces at most @p replmax occurrences.
  *
  * The returned string will be allocated by @p allocator and is guaranteed
@@ -996,7 +995,7 @@
  *
  * @param allocator the allocator to use
  * @param str the string where replacements should be applied
- * @param pattern the pattern to search for
+ * @param search the string to search for
  * @param replacement the replacement string
  * @param replmax maximum number of replacements
  * @return the resulting string after applying the replacements
@@ -1007,15 +1006,14 @@
 cxmutstr cx_strreplacen_a(
         const CxAllocator *allocator,
         cxstring str,
-        cxstring pattern,
+        cxstring search,
         cxstring replacement,
         size_t replmax
 );
 
 /**
- * Replaces a pattern in a string with another string.
+ * Replaces a string with another string.
  *
- * The pattern is taken literally and is no regular expression.
  * Replaces at most @p replmax occurrences.
  *
  * The returned string will be allocated by @c malloc() and is guaranteed
@@ -1025,18 +1023,16 @@
  * the returned string will be empty.
  *
  * @param str (@c cxstring) the string where replacements should be applied
- * @param pattern (@c cxstring) the pattern to search for
+ * @param search (@c cxstring) the string to search for
  * @param replacement (@c cxstring) the replacement string
  * @param replmax (@c size_t) maximum number of replacements
  * @return (@c cxmutstr) the resulting string after applying the replacements
  */
-#define cx_strreplacen(str, pattern, replacement, replmax) \
-cx_strreplacen_a(cxDefaultAllocator, str, pattern, replacement, replmax)
+#define cx_strreplacen(str, search, replacement, replmax) \
+cx_strreplacen_a(cxDefaultAllocator, str, search, replacement, replmax)
 
 /**
- * Replaces a pattern in a string with another string.
- *
- * The pattern is taken literally and is no regular expression.
+ * Replaces a string with another string.
  *
  * The returned string will be allocated by @p allocator and is guaranteed
  * to be zero-terminated.
@@ -1046,18 +1042,15 @@
  *
  * @param allocator (@c CxAllocator*) the allocator to use
  * @param str (@c cxstring) the string where replacements should be applied
- * @param pattern (@c cxstring) the pattern to search for
+ * @param search (@c cxstring) the string to search for
  * @param replacement (@c cxstring) the replacement string
  * @return (@c cxmutstr) the resulting string after applying the replacements
  */
-#define cx_strreplace_a(allocator, str, pattern, replacement) \
-cx_strreplacen_a(allocator, str, pattern, replacement, SIZE_MAX)
+#define cx_strreplace_a(allocator, str, search, replacement) \
+cx_strreplacen_a(allocator, str, search, replacement, SIZE_MAX)
 
 /**
- * Replaces a pattern in a string with another string.
- *
- * The pattern is taken literally and is no regular expression.
- * Replaces at most @p replmax occurrences.
+ * Replaces a string with another string.
  *
  * The returned string will be allocated by @c malloc() and is guaranteed
  * to be zero-terminated.
@@ -1066,12 +1059,12 @@
  * the returned string will be empty.
  *
  * @param str (@c cxstring) the string where replacements should be applied
- * @param pattern (@c cxstring) the pattern to search for
+ * @param search (@c cxstring) the string to search for
  * @param replacement (@c cxstring) the replacement string
  * @return (@c cxmutstr) the resulting string after applying the replacements
  */
-#define cx_strreplace(str, pattern, replacement) \
-cx_strreplacen_a(cxDefaultAllocator, str, pattern, replacement, SIZE_MAX)
+#define cx_strreplace(str, search, replacement) \
+cx_strreplacen_a(cxDefaultAllocator, str, search, replacement, SIZE_MAX)
 
 /**
  * Creates a string tokenization context.

mercurial