UNPKG

@technobuddha/library

Version:
28 lines (27 loc) 1.28 kB
/** * Unescape a string encoded in Java style * * | Escape Sequence | Hex | Character | * | ------------------ | -------------------- | ------------------------ | * | \\b | 0x08 | Backspace | * | \\f | 0x0c | Form Feed | * | \\n | 0x0a | New Line | * | \\r | 0x0d | Carriage Return | * | \\t | 0x09 | Tab | * | \\\\ | 0x5c | Backslash | * | \\' | 0x27 | Single Quote | * | \\" | 0x22 | Double Quote | * | \\unnnn | 0x0000-0xFFFF | Unicode Escape | * @param input - The string to unescape * @returns the string with escapes resolved * @example * ```typescript * unescapeJava('Hello\\nWorld'); // "Hello\nWorld" * unescapeJava('\\u20ac'); // "€" * unescapeJava('\\tTabbed'); // "\tTabbed" * unescapeJava('\\\\'); // "\\" * ``` * @group Programming * @category Escaping */ export declare function unescapeJava(input: string): string;