-1
10 진수 이상으로 3 개 이상의 값을 입력하면 아래의 코드에 오류가 발생합니다. 하지만 십진수에서 길이를 2에서 3으로 늘리고 싶습니다.소수점 이하 길이
나는 precisionValue.length()>2
에서 precisionValue.length()>3
으로 증가했습니다. 그러나 오류는 동일하게 유지됩니다.
if (str != null && str.length() > 0) {
boolean month2 = validator.validateDecimal(str.trim());
if (!month2) {
errors.rejectValue(MONTH2, "10005");
}
if(str.contains(".")){
String decValue = str.substring(0, str.indexOf("."));
String precisionValue = str.substring(str.indexOf(".")+1);
if(decValue.length()>9) {
errors.rejectValue(MONTH2, "10035");
}
if(precisionValue.length()>2) {
errors.rejectValue(MONTH2, "10038");
}
}
else if(str.length()>9) {
errors.rejectValue(MONTH2, "10035");
}
}
프로그래밍 언어를 언급하면 마법사가됩니다. – JJJ