[FO] 일계부 소수점 포함된 숫자 데이터에 getStringComma 추가
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
package app.module.core.config.application.util;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
@@ -10,6 +13,7 @@ import java.util.Locale;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class DailyUtil {
|
||||
|
||||
/**
|
||||
@@ -103,4 +107,25 @@ public class DailyUtil {
|
||||
|
||||
return (limitStart.isBefore(startDate) || limitStart.isEqual(startDate));
|
||||
}
|
||||
|
||||
/**
|
||||
* 문자형 타입의 숫자에 콤마 적용
|
||||
*
|
||||
* @param value 입력 데이터
|
||||
* @return 숫자(콤마, 도트)
|
||||
*/
|
||||
public String getStringComma(String value) {
|
||||
if (StringUtils.isBlank(value)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
String[] values = value.split("\\.");
|
||||
if (values.length > 1) {
|
||||
Double input = Double.parseDouble(values[0]);
|
||||
|
||||
return new DecimalFormat("###,###").format(input) + "." + values[1];
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user