From 43d11becdfc0d7af00b10e91b962cd0c4738bbf1 Mon Sep 17 00:00:00 2001
From: fwq <582742538@qq.com>
Date: 星期一, 11 十二月 2023 10:41:56 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/main/java/com/hx/util/NumberUtil.java |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/hx/util/NumberUtil.java b/src/main/java/com/hx/util/NumberUtil.java
index 59b9581..9ed21d0 100644
--- a/src/main/java/com/hx/util/NumberUtil.java
+++ b/src/main/java/com/hx/util/NumberUtil.java
@@ -383,4 +383,36 @@
         return str;
     }
 
+    /** 鏍¢獙瀛楃涓叉槸鍚︽暣鏁� */
+    public static boolean checkStrIsInt(String str){
+        if(StringUtils.isEmpty(str)){
+            return false;
+        }
+        try{
+            Integer.parseInt(str);
+            return true;
+        }catch (Exception e){
+            return false;
+        }
+    }
+
+    /**
+     * 瀛楃涓茶浆鏁村舰
+     * @param str
+     * @param defInt    榛樿鏁存暟
+     * @return
+     */
+    public static int strChangeInt(String str, Integer defInt){
+        if(defInt == null){
+            defInt = 0;
+        }
+        if(StringUtils.isEmpty(str)){
+            return defInt;
+        }
+        try{
+            return Integer.parseInt(str);
+        }catch (Exception e){
+            return defInt;
+        }
+    }
 }

--
Gitblit v1.8.0