mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2026-04-06 13:10:33 +02:00
utils: Add 'string-replace-substring'.
* guix/utils.scm (string-replace-substring): New procedure. Based on
code by Mark H. Weaver.
* tests/utils.scm ("string-replace-substring"): New test.
This commit is contained in:
@@ -82,6 +82,14 @@
|
||||
(string-tokenize* "foo!bar!" "!")
|
||||
(string-tokenize* "foo+-+bar+-+baz" "+-+")))
|
||||
|
||||
(test-equal "string-replace-substring"
|
||||
'("foo BAR! baz"
|
||||
"/gnu/store/chbouib"
|
||||
"")
|
||||
(list (string-replace-substring "foo bar baz" "bar" "BAR!")
|
||||
(string-replace-substring "/nix/store/chbouib" "/nix/" "/gnu/")
|
||||
(string-replace-substring "" "foo" "bar")))
|
||||
|
||||
(test-equal "fold2, 1 list"
|
||||
(list (reverse (iota 5))
|
||||
(map - (reverse (iota 5))))
|
||||
|
||||
Reference in New Issue
Block a user