Package edu.stanford.nlp.math
Class NumberMatchingRegex
- java.lang.Object
-
- edu.stanford.nlp.math.NumberMatchingRegex
-
public class NumberMatchingRegex extends Object
This file includes a regular expression to match numbers. This will save quite a bit of time in places where you want to test if something is a number without wasting the time to parse it or throw an exception if it isn't. For example, you can call isDouble() to see if a String is a double without having to try/catch the NumberFormatException that gets produced if it is not. The regular expression is conveniently provided in the javadoc for Double. http://java.sun.com/javase/6/docs/api/java/lang/Double.html- Author:
- John Bauer (sort of)
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanisDecimalInteger(String string)Tests to see if an integer is a decimal integer, perhaps starting with +/-.static booleanisDouble(String string)Returns true if the number can be successfully parsed by Double.
-
-
-
Method Detail
-
isDecimalInteger
public static boolean isDecimalInteger(String string)
Tests to see if an integer is a decimal integer, perhaps starting with +/-.
-
isDouble
public static boolean isDouble(String string)
Returns true if the number can be successfully parsed by Double. Locale specific to English and ascii numerals.
-
-