티스토리 뷰
공부
[thymeleaf] Utility Objects(Strings, Numbers, Objects, Arrays, Lists, Maps, Messages, Dates, Calendars); comma
승가비 2023. 9. 16. 13:45728x90
https://hajoung56.tistory.com/72
[Thymeleaf] 타임리프 주요 기능 유틸리티 - Utility Objects(Strings, Numbers, Objects, Arrays, Lists, Maps, Messages,
아래 링크와 같이 이전에는 타임리프 정의와 사용방법에 기본적인 기능들을 간단히 설명하였지만, 이번 글에서 주요 유틸리티를 안내합니다. [Thymeleaf] 정의와 사용방법 Thymeleaf의 정의와 사용하
hajoung56.tistory.com
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal;
import java.text.NumberFormat;
import java.util.Arrays;
import java.util.List;
@Slf4j
public class CommonUtil {
public static final String DOT = ".";
public static String comma(BigDecimal n) {
return comma(String.valueOf(n));
}
public static String comma(double n) {
return comma(String.valueOf(n));
}
public static String comma(String n) {
try {
List<String> h = Arrays.asList(StringUtils.split(n, CommonUtil.DOT));
String decimal = h.size() == 2 ?
"." + h.get(1) :
"";
return comma(Integer.parseInt(h.get(0))) + decimal;
} catch (Exception e) {
log.warn("NaN <{}>", n);
return n;
}
}
public static String comma(int n) {
return NumberFormat.getNumberInstance().format(n);
}
}
Thousands separator thymeleaf: use apostrophe
I'm using thymeleaf to render my views. Is it possible to use ' (apostrophe) as a thousands seperator? Example: What I want is to replace WHITESPACE in the following example with a Value for an
stackoverflow.com
728x90
'공부' 카테고리의 다른 글
[sh] history -c & history -d 1 (0) | 2023.09.16 |
---|---|
[logback] rollingPolicy (0) | 2023.09.16 |
[spring] @Mapper (Object -> ObjectDto) (0) | 2023.09.10 |
[rdbms] transaction (0) | 2023.09.10 |
[mysql] 복합 index 인 경우, 카디널리티 높은 -> 낮은 (중복적은 -> 중복많은) (0) | 2023.09.10 |
댓글
250x250
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- 김달
- Kluge
- 개리마커스
- follower
- 책그림
- 테슬라 추천
- 테슬라 리퍼럴 코드 혜택
- 테슬라 레퍼럴
- 테슬라
- 모델y
- 테슬라 리퍼럴 코드 생성
- 테슬라 레퍼럴 적용 확인
- 레퍼럴
- Bot
- 어떻게 능력을 보여줄 것인가?
- 메디파크 내과 전문의 의학박사 김영수
- wlw
- 연애학개론
- 모델 Y 레퍼럴
- 할인
- COUNT
- 클루지
- 유투브
- 인스타그램
- 테슬라 크레딧 사용
- 테슬라 레퍼럴 코드 확인
- 테슬라 리퍼럴 코드
- 팔로워 수 세기
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
글 보관함