escapeC
lib.strings.escapeC
Docs pulled from | This Revision | 18 days ago
Nixpkgs manual
Escape occurrence of the element of list in string by
converting to its ASCII value and prefixing it with \x.
Only works for printable ascii characters.
Inputs
list- 1. Function argument
string- 2. Function argument
Type
escapeC :: [String] -> String -> String
Examples
lib.strings.escapeC usage example
escapeC [" "] "foo bar"
=> "foo\\x20bar"
Noogle detected
Implementation
The following is the current implementation of this function.
escapeC =
list:
replaceStrings list (
map (c: "\\x${fixedWidthString 2 "0" (toLower (lib.toHexString (charToInt c)))}") list
);