Numeric classes need static checker methods for Strings

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Duplicate
    • Priority: P5
    • None
    • Affects Version/s: 7
    • Component/s: core-libs
    • x86
    • windows_xp

      A DESCRIPTION OF THE REQUEST :
      The only way to check if a numeric String has a valid format is to try to parse it an catch the exception thrown. I'm requesting an easy way to make sure that a String has a valid numeric format.

      JUSTIFICATION :
      Writing this kind of code to perform a basic task, to find out the validity of a number, is not acceptable.

      boolean isNumeric = true; try{Integer.parseInt(fieldValue);}catch(Exception e){isNumeric = false;}

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      boolean isNumeric = Integer.isInt(s);

      boolean isNumeric = Integer.isInt(s,radix);

      Similar methods should be implemented in the Byte, Short, Integer, Long, Float and Double classes.

            Assignee:
            Joe Darcy
            Reporter:
            Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: