Skip to content

@technobuddha > library > Programming > Escaping

Function: unescapeJava()

ts
function unescapeJava(input: string): string;

Defined in: unescape-java.ts:30

Unescape a string encoded in Java style

Escape SequenceHexCharacter
\b0x08Backspace
\f0x0cForm Feed
\n0x0aNew Line
\r0x0dCarriage Return
\t0x09Tab
\\0x5cBackslash
\'0x27Single Quote
\"0x22Double Quote
\unnnn0x0000-0xFFFFUnicode Escape

Parameters

ParameterTypeDescription
inputstringThe string to unescape

Returns

string

the string with escapes resolved

Example

typescript
unescapeJava('Hello\\nWorld'); // "Hello\nWorld"
unescapeJava('\\u20ac'); // "€"
unescapeJava('\\tTabbed'); // "\tTabbed"
unescapeJava('\\\\'); // "\\"