roojs-ui.js
[roojs1] / String.js
index e7272dc..f5a603e 100644 (file)
--- a/String.js
+++ b/String.js
@@ -66,22 +66,6 @@ var s = String.format('<div class="{0}">{1}</div>', cls, text);
         return format.replace(/\{(\d+)\}/g, function(m, i){
             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;
-            }
-        );
     }
   
     
@@ -106,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;
+        }
+    );
+};
+