X-Git-Url: http://git.roojs.org/?p=roojs1;a=blobdiff_plain;f=String.js;h=50969989b4a9a85f6c9478be5d25739d9b8d0954;hp=e2bdfe904f39d872a802ea45462684536c7c300c;hb=5f0c20d0c4e6eb4fb63ad64ac5dd3323de1b6c0c;hpb=8412dfe204a780961c703b2f80ac885233474b31
diff --git a/String.js b/String.js
index e2bdfe904f..50969989b4 100644
--- a/String.js
+++ b/String.js
@@ -67,18 +67,6 @@ var s = String.format('
{1}
', cls, text);
return Roo.util.Format.htmlEncode(args[i]);
});
}
- function unicodeClean() {
- return this.replace(/[\s\S]/g, function(character) {
- if (character.charCodeAt()< 256) {
- return character;
- }
- try {
- encodeURIComponent(character);
- } catch(e) {
- return '';
- }
- return character;
- });
});
@@ -102,4 +90,37 @@ sort = (sort == 'ASC' ? 'DESC' : 'ASC');
String.prototype.toggle = function(value, other){
return this == value ? other : value;
-};
\ No newline at end of file
+};
+
+
+/**
+ * Remove invalid unicode characters from a string
+ *
+ * @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;
+ }
+ );
+};
+
+
+/**
+ * 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);
+};
+