converter/app/converter/htmlentitiesdecoder.ts
Manuel Friedli 01df7ac29c added 6 more converters:
- dec <-> bin
- dec <-> hex
- htmlentities de- and encode
2016-09-20 21:12:13 +02:00

20 lines
454 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, "&");
}
}