﻿var noise_words = [
'a',
'about',
'above',
'across',
'after',
'again',
'against',
'along',
'although',
'among',
'an',
'and',
'another',
'any',
'anybody',
'anyone',
'around',
'as',
'at',
'because',
'before',
'behind',
'below',
'beside',
'between',
'beyond',
'both',
'but',
'by',
'close',
'down',
'due',
'during',
'each',
'early',
'either',
'even',
'everybody',
'everyone',
'everything',
'everywhere',
'few',
'for',
'from',
'he',
'her',
'here',
'herself',
'him',
'himself',
'how',
'however',
'if',
'in',
'inside',
'into',
'it',
'it’s',
'its',
'itself',
'just',
'late',
'many',
'me',
'mol',
'much',
'myself',
'near',
'neither',
'never',
'nevertheless',
'next',
'nobody',
'noone',
'nothing',
'now',
'of',
'on',
'once',
'one',
'oneself',
'only',
'onto',
'or',
'other',
'otherwise',
'ourselves',
'outside',
'over',
'past',
'per',
'pin',
'same',
'she',
'since',
'so',
'some',
'somebody',
'someone',
'something',
'sometimes',
'soon',
'still',
'such',
'suddenly',
'sure',
'than',
'that',
'the',
'their',
'them',
'themeselves',
'then',
'there',
'these',
'they',
'this',
'those',
'though',
'through',
'throughout',
'till',
'to',
'too',
'towards',
'under',
'unless',
'until',
'up',
'upon',
'us',
'versus',
'via',
'we',
'what',
'whatever',
'when',
'whenever',
'where',
'whereas',
'wherever',
'which',
'whichever',
'while',
'who',
'whoever',
'whom',
'why',
'with',
'within',
'without',
'yet',
'you',
'yourself',
'yourselves'
];
String.prototype.Trim = function () {
    return this.replace(/(^\s+)|(\s+$)/g, "");
};
String.prototype.capitalizeWithoutNoise = function () {
    var string = this.toLowerCase().replace(/(^|\s|>)([a-zA-Z-])(\w*)/g, function (m, p1, p2, p3) {
        var word = (p2 + p3).toLowerCase();
        for (var i = 0, length = noise_words.length; i < length; i++)
            if (noise_words[i] === word)
                return m.toLowerCase();
        return p1 + p2.toUpperCase() + p3;
    });
    var f = string.charAt(0).toUpperCase();
    string = f + string.substr(1);
    return string;
};
String.prototype.capitalizeWithNoise = function () {
    var string = this.toLowerCase().replace(/(^|\s|>|\.|-)([a-zA-Z])(\w*)/g, function (m, p1, p2, p3) {
        var word = p2 + p3;
        return p1 + p2.toUpperCase() + p3;
    });
    var f = string.charAt(0).toUpperCase();
    string = f + string.substr(1);
    return string;
};
String.prototype.capitalizeWithoutNoiseHyphened = function () {
    var string = this.replace(/(^|\s|\-|>)([a-zA-Z])(\w*)/g, function (m, p1, p2, p3) {
        var word = (p2 + p3).toLowerCase();
        for (var i = 0, length = noise_words.length; i < length; i++) {
            if (noise_words[i] === word) {
                return p1 + word;
            }
        }
        return p1 + p2.toUpperCase() + p3;
    });
    var f = string.charAt(0).toUpperCase();
    string = f + string.substr(1);
    return string;
};
