TypeInferenceUtils { static boolean isNumber(String s) { try { Double.parseDouble(s); } catch (NumberFormatException e) { return false; } return true; } private  TypeInferenceUtils(); static TSDataType getPredictedDataType(Object value, boolean inferType);  }
@Test public void isNumberTest() { String[] values = {"123", "123.123", "-123.123", "+123.123", ".123", String.valueOf(Integer.MAX_VALUE), String.valueOf(Integer.MIN_VALUE), String.valueOf(Double.MAX_VALUE), String.valueOf(Double.MIN_VALUE), "abc", "123.", "123a", TsFileConstant.PATH_SEPARATOR, "123.1.23"}; boolean[] results = {true, true, true, true, true, true, true, true, true, false, true, false, false, false}; for (int i = 0; i < values.length; i++) { assertEquals(TypeInferenceUtils.isNumber(values[i]), results[i]); } }