본문 바로가기
프로그래밍/Android

[Android] isNullOrBlank, isNullOrEmpty의 차이점

by Youngs_ 2023. 1. 10.
fun main() {
  val thisIsBlank = "   "

  println(thisIsBlank.isNullOrEmpty())
  println(thisIsBlank.isNullOrBlank())
}

 

 

 

 

출력결과

false
true

 

아무것도 없는 단순 공백은 isNullOrBlank가 true를 반환하고, isNullOrEmpty는 false를 반환한다.


출처 : https://stackoverflow.com/questions/60979747/kotlin-what-is-difference-between-isnullorempty-and-isnullorblank

 

kotlin : what is difference between isNullOrEmpty and isNullOrBlank?

I want check value of my EditText in android so I saw two function for my String value : user.isNullOrBlank() and user.isNullOrEmpty() what is difference between them?

stackoverflow.com

 

댓글