String.implement({
    
	isNumeric: function(value) {
        return this.match(/^\d+$/) != null;
	},

    isAlpha: function(value) {
        return this.match(/^[a-zA-Z]+$/) != null;
    },
	
	onlyNumeric: function() {
    	var value = this;
	    var newValue = "";
	    for (var i = 0; i < value.length; i++) {
	        if (this.charAt(i).isNumeric()) {
	            newValue += value.charAt(i);
	        }
	    }
	    return newValue;
	},

	onlyAlpha: function() {
		var value = this;
        var newValue = "";
        for (var i = 0; i < value.length; i++) {
            if (this.charAt(i).isAlpha()) {
                newValue += value.charAt(i);
            }
        }
        return newValue;
	},
	
	leftPad: function(size, pad) {
	    var newValue = this;
	    while (newValue.length < size) {
	        newValue = pad + newValue;
	    }
	    return newValue;
	},
	
    insert: function(index, newValue) {
        var len = this.length;
        var value = this;
        var a = (index <= 0) ? "" : value.substr(0, index);
        var b = (index >= len) ? "" : value.substr(index, len-index);
        return a + newValue + b;
    },

    isEmpty: function() {
        return this.trim().length == 0;
    }

});