converter/app/converter/htmlentitiesencoder.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
449 B
TypeScript

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