From d3fa1dd2262fc311661aa675e4a30b2423c7b130 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期四, 04 二月 2021 10:35:02 +0800 Subject: [PATCH] Merge pull request #47 from lawrencehj/master --- 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..f9fbfb1 --- /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 an Integer!"); + return true; + } catch (Exception e) { + System.out.println(str + " Is not an Integer!"); + 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 Number!"); + return true; + } catch (Exception e) { + System.out.println(str + " Is not Number!"); + return false; + } + } +} -- Gitblit v1.8.0