escape

escape, function

def const pure escape(source: text): text

Returns source as an Envision text literal, escaping special characters and surrounding it with quotes.

Examples

table T = with
  [| as Text |]
  [| "" |]
  [| "ABC" |]
  [| "15\" Screen" |]
  [| " Space " |]

T.Escaped = escape(T.Text)

show table "Escaped" with
  T.Text
  T.Escaped

This produces the following table:

Text Escaped
""
ABC “ABC”
15" Screen “15" Screen”
Space " Space "

Remarks

Characters outside the ASCII range are encoded as one or more \uXXXX escape sequences.

User Contributed Notes
0 notes + add a note