


String.prototype.compareTo = function (value, ignoreCase)
{
    if (isObjectNullOrUndefined(ignoreCase))
    {
        ignoreCase = false;
    }

    else if (!isObjectBoolean(ignoreCase))
    {
        throw "The caseSenstivity parameter is not a valid boolean.";
    }

    if (!isObjectString(value))
    {
        throw "The input value is not a valid string.";
    }

    if (!ignoreCase)
    {
        return (this === value);
    }

    return (this.toLowerCase() === value.toLowerCase());
}



String.prototype.repeat = function (count)
{
    if (!isObjectNumber(count) || count < 0)
    {
        throw "The repeat count is not a valid number.";
    }

    if (count === 0)
    {
        return "";
    }

    return new Array(count + 1).join(this);
}



String.prototype.trimStart = function ()
{
    return this.replace(/^\s+/, "");
}



String.prototype.trimEnd = function ()
{
    return this.replace(/\s+$/, "");
}



String.prototype.trim = function ()
{
    return this.trimStart().trimEnd();
}


