query
On this page

escapeC

lib.strings.escapeC

Docs pulled from | This Revision | 10 minutes ago


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
    );