jweinst1
12/1/2015 - 6:31 AM

implementation of a mutable string object in js.

implementation of a mutable string object in js.

//mutable string object using function notation initialization

function mstring(text) {
    this.text = text;
    this.pop = function() {
        this.text = this.text.substring(0, this.text.length-1);
    };
    this.append = function(string) {
        this.text += string;
    };
    this.remove_char = function(num) {
        this.text = this.text.replace(r[num], "");
    };
}