The string_escaping.py
module#
Summary#
Escape a string according to ModelCenter conventions. |
|
Unescape a string according to |
Description#
Provides functions for ModelCenter-standard string escaping.
Module detail#
- string_escaping.escape_string(unescaped: str) str #
Escape a string according to ModelCenter conventions.
The following characters are escaped: backslash, newline, carriage return, tab, double-quote, and null. Backslash is itself used as an escape character.
- string_escaping.unescape_string(escaped: str) str #
Unescape a string according to
ModelCenter
conventions.The escape sequences
\n
,\r
,\t
, and\0
are transformed into newline, carriage return, tab, and null respectively. In other cases where a backslash appears, it is simply removed and the following character is allowed to remain. (Note that this also results in the correct behavior for double-quotatoin marks and the backslash itself, even though those characters are escaped by theescape_string()
method.)