parent
7aaf0a799a
commit
f289467691
7 changed files with 44 additions and 11 deletions
@ -0,0 +1,26 @@ |
||||
package com.daqing.financial.guarantee.util; |
||||
|
||||
|
||||
import java.util.regex.Pattern; |
||||
|
||||
public class MoneyUtil { |
||||
|
||||
//两位小数金额校验
|
||||
public static boolean judgeTwoDecimal(Object obj) { |
||||
boolean flag = false; |
||||
try { |
||||
if (obj != null) { |
||||
String source = obj.toString(); |
||||
// 判断是否是整数或者是携带一位或者两位的小数
|
||||
Pattern pattern = Pattern.compile("^[+]?([0-9]+(.[0-9]{1,2})?)$"); |
||||
if (pattern.matcher(source).matches()) { |
||||
flag = true; |
||||
} |
||||
} |
||||
} catch (Exception e) { |
||||
e.getMessage(); |
||||
} |
||||
return flag; |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue