Türkçe ilk harfleri büyütme prototype


//http://stackoverflow.com/a/1026087/181295
String.prototype.turkishUpperCase = function () {
    return this.replace(/ğ/g, 'Ğ')
        .replace(/ü/g, 'Ü')
        .replace(/ş/g, 'Ş')
        .replace(/ı/g, 'I')
        .replace(/i/g, 'İ')
        .replace(/ö/g, 'Ö')
        .replace(/ç/g, 'Ç')
        .toUpperCase();
};
//String.turkishUpperCase

String.prototype.turkishLowerCase = function () {
    return this.replace(/Ğ/g, 'ğ')
        .replace(/Ü/g, 'ü')
        .replace(/Ş/g, 'ş')
        .replace(/I/g, 'ı')
        .replace(/İ/g, 'i')
        .replace(/Ö/g, 'ö')
        .replace(/Ç/g, 'ç')
        .toLowerCase();
};
//String.turkishLowerCase

String.prototype.turkishCapitalize = function() {
    return this.charAt(0).turkishUpperCase() + this.slice(1).turkishLowerCase()
};
//String.turkishCapitalize

String.prototype.turkishCapitalizeWords = function() {
    var a = this.split(' ');
    for(var i=0;i < a.length; i++) a[i] = a[i].turkishCapitalize();
    return a.join(' ');
};
//String.turkishCapitalizeWords