From b8c69ce26b3bb9462b1e0578f9e119c9772f9126 Mon Sep 17 00:00:00 2001
From: cmg <527198563@qq.com>
Date: 星期一, 27 五月 2024 14:33:22 +0800
Subject: [PATCH] 0527芙艾合并更新

---
 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