tango.text.json.JsonEscape

License:

BSD style: see license.txt

Version:

July 2008: Initial release

Authors:

Kris
T[] unescape(T)(const(T)[] src, T[] dst = null)
Convert 'escaped' chars to normal ones. For example: \\ => \
The provided output buffer should be at least as long as the input string, or it will be allocated from the heap instead.

Returns a slice of dst where the content required conversion, or the provided src otherwise
T[] escape(T)(const(T)[] src, T[] dst = null)
Convert reserved chars to escaped ones. For example: \ => \\
Either a slice of the provided output buffer is returned, or the original content, depending on whether there were reserved chars present or not. The output buffer will be expanded as necessary
void unescape(T)(const(T)[] src, scope void delegate(const(T)[]) emit)
Convert 'escaped' chars to normal ones. For example: \\ => \
This variant does not require an interim workspace, and instead emits directly via the provided delegate
void escape(T)(const(T)[] src, scope void delegate(const(T)[]) emit)
Convert reserved chars to escaped ones. For example: \ => \\
This variant does not require an interim workspace, and instead emits directly via the provided delegate