query
On this page

replaceString

lib.strings.replaceString

Docs pulled from | This Revision | 18 minutes ago


Nixpkgs manual

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

Aliases

Implementation

The following is the current implementation of this function.

replaceString = from: to: replaceStrings [ from ] [ to ];