MessageFormat.escape() method

Escape characaters that may be considered as MessageFormat markup

Signature:

static escape(str: string, octothorpe?: boolean): string;

Parameters

Parameter Type Description
str string The input string
octothorpe boolean (Optional) Also escape #

Returns:

string

The escaped string

Remarks

This surrounds the characters {, } and optionally # with ‘quotes’. This will allow those characters to not be considered as MessageFormat control characters.