StringEscape

Description

[ShutdownSurvive]
sealed class Tinman.Core.Formatting.StringEscape

Helper class for setting up rules for string escaping.

Public / Constants

LineSingleQuote


public static readonly attribute LineSingleQuote → (StringEscape)

Common escaping rules capturing strings in a single line, enclosed by single quotes.

['] (0x22) => [\'] (0x5C, 0x22)
[ ] (0x09) => [\t] (0x5C, 0x74)
[ ] (0x0A) => [\n] (0x5C, 0x6E)
[ ] (0x0D) => [\r] (0x5C, 0x72)
[\] (0x5C) => [\\] (0x5C, 0x5C)

None


public static readonly attribute None → (StringEscape)

No string escaping.

Public / Methods

Add

2 overloads


public method Add1 → (1)

rule in : IStringOp

[not-null]
The reversible string operation that represents the string escaping rule to add.

returns → StringEscape

this

Adds the given string escaping rule.


public method Add2 → (2)

plain in : string

[not-empty]
The plain token.

escaped in : string

[not-empty]
The escaped token.

returns → StringEscape

The resulting StringEscape object.

Adds the given plain/escaped pair to this string escape object.

Escape


public method Escape → (1)

plain in : string

The plain string.

returns → string

The escaped string.

Escapes the given plain string by applying all escaping rules.

Unescape


public method Unescape → (1)

escaped in : string

The escaped string.

returns → string

The plain string.

Unescapes the given escaped string by reversing all escaping rules.