converter/src/app/converter/htmlentitiesdecoder.ts

20 lines
410 B
TypeScript

import {Converter} from './converter';
export class HTMLEntitiesDecoder implements Converter {
getDisplayname(): string {
return 'Decode HTML entities';
}
getId(): string {
return 'decodehtmlentities';
}
convert(input: string): string {
return input
.replace(/\&quot\;/g, '\'')
.replace(/\&gt\;/g, '>')
.replace(/\&lt\;/g, '<')
.replace(/\&amp\;/g, '&');
}
}