summaryrefslogtreecommitdiff
path: root/doc/ref
diff options
context:
space:
mode:
authorDaniel Llorens <lloda@sarc.name>2020-01-06 09:44:01 +0100
committerDaniel Llorens <lloda@sarc.name>2020-01-06 09:44:01 +0100
commit6cfee365434ca8a18053600575c79dde6775bc2d (patch)
tree8e62ccc325405eb37970695f6f657422c053394e /doc/ref
parentddad8ae05adfdb84ef80cb2d2730e73f4d27c74b (diff)
downloadguile-6cfee365434ca8a18053600575c79dde6775bc2d.tar.gz
New function string-replace-substring in (ice-9 string-fun)
By A. Wingo in https://lists.gnu.org/archive/html/guile-devel/2014-03/msg00058.html. * module/ice-9/string-fun.scm (string-replace-substring): As stated. * doc/ref/api-data.texi: Document the new function. * test-suite/tests/strings.test: Test.
Diffstat (limited to 'doc/ref')
-rw-r--r--doc/ref/api-data.texi16
1 files changed, 16 insertions, 0 deletions
diff --git a/doc/ref/api-data.texi b/doc/ref/api-data.texi
index 0ea49485f..ede16de64 100644
--- a/doc/ref/api-data.texi
+++ b/doc/ref/api-data.texi
@@ -4227,6 +4227,22 @@ a predicate, if it is a character, it is tested for equality and if it
is a character set, it is tested for membership.
@end deffn
+The following additional functions are available in the module @code{(ice-9 string-fun)}. They can be used with:
+
+@example
+(use-modules (ice-9 string-fun))
+@end example
+
+@deffn {Scheme Procedure} string-replace-substring str substring replacement
+Return a new string where every instance of @var{substring} in string
+@var{str} has been replaced by @var{replacement}. For example:
+
+@lisp
+(string-replace-substring "a ring of strings" "ring" "rut")
+@result{} "a rut of struts"
+@end lisp
+@end deffn
+
@node Representing Strings as Bytes
@subsubsection Representing Strings as Bytes