X-Git-Url: http://git.roojs.org/?p=roojs1;a=blobdiff_plain;f=String.js;h=50969989b4a9a85f6c9478be5d25739d9b8d0954;hp=d326c401862d64cba437e8c8186d059569c0d57d;hb=refs%2Fheads%2Fwip_leon_T7094_logo_image_upload_in_boilerplate;hpb=d3108212a0f995222bf7f1db2da714ed6d6d5d5f diff --git a/String.js b/String.js index d326c40186..50969989b4 100644 --- a/String.js +++ b/String.js @@ -66,7 +66,7 @@ var s = String.format('
{1}
', cls, text); return format.replace(/\{(\d+)\}/g, function(m, i){ return Roo.util.Format.htmlEncode(args[i]); }); - }. + } }); @@ -98,19 +98,29 @@ String.prototype.toggle = function(value, other){ * * @return {String} The clean string */ -String.prototype.unicodeClean: function () { - return this.replace(/[\s\S]/g, - function(character) { - if (character.charCodeAt()< 256) { - return character; - } - try { - encodeURIComponent(character); - } catch(e) { - return ''; - } - return character; - } - ); - } +String.prototype.unicodeClean = function () { + return this.replace(/[\s\S]/g, + function(character) { + if (character.charCodeAt()< 256) { + return character; + } + try { + encodeURIComponent(character); + } catch(e) { + return ''; + } + return character; + } + ); +}; + + +/** + * Make the first letter of a string uppercase + * + * @return {String} The new string. + */ +String.prototype.toUpperCaseFirst = function () { + return this.charAt(0).toUpperCase() + this.slice(1); +};