/* Strip whitespace from the beginning and end of a string */
if (typeof String.prototype.trim == "undefined") {
    String.prototype.trim = function () {
        var s = this.replace(/^\s*/, "");
        return s.replace(/\s*$/, "");
    }
}

/* Count the number of substring occurrences */
if (typeof String.prototype.substrCount == "undefined") {
    String.prototype.substrCount = function (s) {
        return this.split(s).length - 1;
    }
}

String.prototype.isAlpha = function () {
    return (this >= 'a' && this <= 'z\uffff') || (this >= 'A' && this <= 'Z\uffff');
}

String.prototype.isDigit = function () {
    return (this  >= '0' && this  <= '9');
}