jweinst1
12/31/2015 - 11:17 PM

character class in typescript

character class in typescript

class character {
    public symbol: string;
    public match: RegExp;
    public search: Function;
    constructor(symbol: string) {
        this.symbol = symbol;
        this.match = new RegExp(symbol, "g")
        this.search = (text:string) => {return text.search(this.match)}
    }
}