commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nia...@apache.org
Subject svn commit: r330239 - in /jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript: validateInteger.js validateUtilities.js
Date Wed, 02 Nov 2005 11:54:37 GMT
Author: niallp
Date: Wed Nov  2 03:54:25 2005
New Revision: 330239

URL: http://svn.apache.org/viewcvs?rev=330239&view=rev
Log:
Move the isAllDigits() function (used by Short, Integer, Byte and Float validations) from
validateInteger.js to validateUtilities.js

Modified:
    jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateInteger.js
    jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateUtilities.js

Modified: jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateInteger.js
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateInteger.js?rev=330239&r1=330238&r2=330239&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateInteger.js
(original)
+++ jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateInteger.js
Wed Nov  2 03:54:25 2005
@@ -62,23 +62,3 @@
         }
         return bValid;
     }
-
-    function isAllDigits(argvalue) {
-        argvalue = argvalue.toString();
-        var validChars = "0123456789";
-        var startFrom = 0;
-        if (argvalue.substring(0, 2) == "0x") {
-           validChars = "0123456789abcdefABCDEF";
-           startFrom = 2;
-        } else if (argvalue.charAt(0) == "0") {
-           validChars = "01234567";
-           startFrom = 1;
-        } else if (argvalue.charAt(0) == "-") {
-            startFrom = 1;
-        }
-
-        for (var n = startFrom; n < argvalue.length; n++) {
-            if (validChars.indexOf(argvalue.substring(n, n+1)) == -1) return false;
-        }
-        return true;
-    }

Modified: jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateUtilities.js
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateUtilities.js?rev=330239&r1=330238&r2=330239&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateUtilities.js
(original)
+++ jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateUtilities.js
Wed Nov  2 03:54:25 2005
@@ -34,4 +34,28 @@
           }
       }
 
-  }  
\ No newline at end of file
+  }  
+
+  /**
+   * Check a value only contains valid numeric digits
+   * @param argvalue The value to check.
+   */
+  function isAllDigits(argvalue) {
+      argvalue = argvalue.toString();
+      var validChars = "0123456789";
+      var startFrom = 0;
+      if (argvalue.substring(0, 2) == "0x") {
+         validChars = "0123456789abcdefABCDEF";
+         startFrom = 2;
+      } else if (argvalue.charAt(0) == "0") {
+         validChars = "01234567";
+         startFrom = 1;
+      } else if (argvalue.charAt(0) == "-") {
+          startFrom = 1;
+      }
+
+      for (var n = startFrom; n < argvalue.length; n++) {
+          if (validChars.indexOf(argvalue.substring(n, n+1)) == -1) return false;
+      }
+      return true;
+  }



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message