티스토리 뷰

DEV/JAVA

StringUtils.isEmtpty() vs StringUtils.isBlank()

초록매실원액 2016. 3. 18. 13:45

1) isEmpty

public static boolean isEmpty(String str)
Checks if a String is empty ("") or null.

StringUtils.isEmpty(null) = true
StringUtils.isEmpty("") = true
StringUtils.isEmpty(" ") = false
StringUtils.isEmpty("bob") = false
StringUtils.isEmpty(" bob ") = false


2) isBlank

public static boolean isBlank(String str)
Checks if a String is whitespace, empty ("") or null.

StringUtils.isBlank(null) = true
StringUtils.isBlank("") = true
StringUtils.isBlank(" ") = true
StringUtils.isBlank("bob") = false
StringUtils.isBlank(" bob ") = false


'DEV > JAVA' 카테고리의 다른 글

AWS S3 파일업로드  (0) 2019.12.31
spring boot + jasypt  (0) 2017.09.15
POI 로 엑셀파일 읽기(xls , xlsx)  (0) 2016.03.14
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/07   »
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 29 30 31
글 보관함