From 0f58218badea86a5209ae7f1ccd60b7cb4b26eee Mon Sep 17 00:00:00 2001 From: panlinlin <648540858@qq.com> Date: 星期四, 25 二月 2021 18:10:02 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' into wvp-28181-2.0 --- src/main/java/com/genersoft/iot/vmp/gb28181/utils/NumericUtil.java | 41 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 41 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/utils/NumericUtil.java b/src/main/java/com/genersoft/iot/vmp/gb28181/utils/NumericUtil.java new file mode 100644 index 0000000..4a399b8 --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/utils/NumericUtil.java @@ -0,0 +1,41 @@ +package com.genersoft.iot.vmp.gb28181.utils; + +/** + * 鏁板�兼牸寮忓垽鏂拰澶勭悊 + * @author lawrencehj + * @date 2021骞�1鏈�27鏃� + */ +public class NumericUtil { + + /** + * 鍒ゆ柇鏄惁Double鏍煎紡 + * @param str + * @return true/false + */ + public static boolean isDouble(String str) { + try { + Double num2 = Double.valueOf(str); + System.out.println(num2 + " is a valid numeric string!"); + return true; + } catch (Exception e) { + System.out.println(str + " is an invalid numeric string!"); + return false; + } + } + + /** + * 鍒ゆ柇鏄惁Double鏍煎紡 + * @param str + * @return true/false + */ + public static boolean isInteger(String str) { + try { + int num2 = Integer.valueOf(str); + System.out.println(num2 + " is an integer!"); + return true; + } catch (Exception e) { + System.out.println(str + " is not an integer!"); + return false; + } + } +} -- Gitblit v1.8.0