replaceString
lib.replaceString
Docs pulled from | This Revision | about 1 hour ago
Given string s
, replace every occurrence of the string from
with the string to
.
Inputs
from
- The string to be replaced
to
- The string to replace with
s
- The original string where replacements will be made
Type
replaceString :: string -> string -> string -> string
Examples
lib.strings.replaceString
usage example
replaceString "world" "Nix" "Hello, world!"
=> "Hello, Nix!"
replaceString "." "_" "v1.2.3"
=> "v1_2_3"
Noogle detected
Implementation
The following is the current implementation of this function.
replaceString = from: to: replaceStrings [ from ] [ to ];