From 55334da20cff4dac840c320eda1d0ca53ba27eda Mon Sep 17 00:00:00 2001 From: fwq <582742538@qq.com> Date: 星期一, 23 九月 2024 14:26:36 +0800 Subject: [PATCH] Merge branch 'master-stander' into master-xlk --- 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