mirror of
https://github.com/NixOS/nix
synced 2025-07-10 04:43:53 +02:00
Add replaceStrings primop
This is a generalisation of replaceChars in Nixpkgs.
This commit is contained in:
parent
2e8fd4c5cd
commit
d6d5885c15
4 changed files with 63 additions and 1 deletions
1
tests/lang/eval-okay-replacestrings.exp
Normal file
1
tests/lang/eval-okay-replacestrings.exp
Normal file
|
@ -0,0 +1 @@
|
|||
[ "faabar" "fbar" "fubar" "faboor" "fubar" ]
|
8
tests/lang/eval-okay-replacestrings.nix
Normal file
8
tests/lang/eval-okay-replacestrings.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
with builtins;
|
||||
|
||||
[ (replaceStrings ["o"] ["a"] "foobar")
|
||||
(replaceStrings ["o"] [""] "foobar")
|
||||
(replaceStrings ["oo"] ["u"] "foobar")
|
||||
(replaceStrings ["oo" "a"] ["a" "oo"] "foobar")
|
||||
(replaceStrings ["oo" "oo"] ["u" "i"] "foobar")
|
||||
]
|
Loading…
Add table
Add a link
Reference in a new issue