about summary refs log tree commit diff
path: root/doc/manual
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2015-07-24T13·32+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-07-24T13·32+0200
commitd6d5885c1567454754a0d260521bafa0bd5e7fdb (patch)
treee97b212c7d752c4b37ff29536c3c3315c11d3088 /doc/manual
parent2e8fd4c5cdeb59ae2bd403aa5069993303e8388e (diff)
Add replaceStrings primop
This is a generalisation of replaceChars in Nixpkgs.
Diffstat (limited to 'doc/manual')
-rw-r--r--doc/manual/expressions/builtins.xml17
1 files changed, 17 insertions, 0 deletions
diff --git a/doc/manual/expressions/builtins.xml b/doc/manual/expressions/builtins.xml
index cb987ca02772..099f90e786e5 100644
--- a/doc/manual/expressions/builtins.xml
+++ b/doc/manual/expressions/builtins.xml
@@ -733,6 +733,23 @@ removeAttrs { x = 1; y = 2; z = 3; } [ "a" "x" "z" ]</programlisting>
   </varlistentry>
 
 
+  <varlistentry><term><function>builtins.replaceStrings</function>
+  <replaceable>from</replaceable> <replaceable>to</replaceable> <replaceable>s</replaceable></term>
+
+    <listitem><para>Given string <replaceable>s</replaceable>, replace
+    every occurrence of the strings in <replaceable>from</replaceable>
+    with the corresponding string in
+    <replaceable>to</replaceable>. For example,
+
+<programlisting>
+builtins.replaceStrings ["oo" "a"] ["a" "i"] "foobar"
+</programlisting>
+
+    evaluates to <literal>"fabir"</literal>.</para></listitem>
+
+  </varlistentry>
+
+
   <varlistentry><term><function>builtins.seq</function>
   <replaceable>e1</replaceable> <replaceable>e2</replaceable></term>