qtil
advanced-security/qtil-swift 0.0.3
Search

Module SeparatedEscape

A module for making CSV-like separated strings, with a custom separator and escape character.

When the separator or escape character is found in a string to be concatenated, it is escaped with the escape character. For example, if the separator is , and the escape character is \, then adding joining foo,bar with baz\\qux will yield foo\\,bar,baz\\\\qux.

Example usage:

import SeparatedEscape<Separator::comma/0, defaultEscapeMap> as CSV

// Selects "foo\\,bar,baz\\\\qux"
select CSV::EscapeBackslash::join("foo,bar", "baz\\qux")

// Selects [0, "foo,bar"] and [1, "baz\\qux"]
from int i, string s
where s = CSV::EscapeBackslash::split("foo\\bar,baz\\\\qux", i)
select i, s

string getItem(int i) { ... }
select CSV::concatIndexed<getItem/1>::join()

Import path

import qtil.strings.Escape

Predicates

escapeItem

Escape a string using the escape map, using backslash as the escape character.

escapeItem

Escape a string using the escape map, using a custom escape character.

split

Split a string into its unescaped component parts, by the separator character, using backslash as the escape character.

split

Split and unescape the nth item in the string, starting at zero, separated by the separator character.

split

Split and unescape the nth item in the string, starting at zero, separated by the separator character, escaped by a custom escape character.

splitWithEscaper

Split a string into its unescaped component parts, by the separator character, using a custom escape character.

unescapeItem

Unescape a string using the escape map, using backslash as the escape character.

unescapeItem

Unescape a string using the escape map, using backslash as the escape character.

Modules

Concat

A module that can concatenate all of the results of a predicate, unordered, using the specified separator and escaping each item as necessary.

EscapeBackslash

A module containing a set of functions of2, of3, etc., that construct a separated list using the specified separator and backslash as the escape character, escaping entries as necessary.

EscapedWith

A module containing a set of functions of2, of3, etc., that construct a separated list using the specified separator and a custom escape character, escaping entries as necessary.

Parameters

separatorpred
escapeMappred