qtil
advanced-security/qtil-swift 0.0.3
Search

Predicate WrapEscape::wrapEscaping

Escape a string using the escape map, and wrap the result with the wrapping character.

The wrapping character, and the escape character, are also both escaped in the string.

For example:

import WrapEscaping<Separator::percent/0, defaultEscapeMap>

// Selects "%foo\\%bar\\\\baz" and "%foo\\%bar\\\\baz\\nqux".
select wrapEscaping("foo%bar\\baz", "\\"), wrapEscaping("foo%bar\\baz\nqux", "\\")

// Selects "%foo.%bar..baz" and "%foo%bar..baz.nqux".
select wrapEscaping("foo%bar$baz", "."), wrapEscaping("foo%bar$baz\nqux", ".")

Import path

import qtil.strings.Escape
string wrapEscaping(string str, Char escape)