X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=String.js;h=f5a603e79dc40d54767f8da2f31f422a2fc1d630;hb=e48ce1c5e71b3d18391128ea45810effc0d036b0;hp=e2bdfe904f39d872a802ea45462684536c7c300c;hpb=8412dfe204a780961c703b2f80ac885233474b31;p=roojs1
diff --git a/String.js b/String.js
index e2bdfe904f..f5a603e79d 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,27 @@ 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;
+ }
+ );
+};
+