2020-07-03から1日間の記事一覧
空白チェックを行う場合、if elseでもいいが、ifEmptyやifBlankでも便利にできる。 if elseの場合 val result = if (dummyText.isEmpty()) "hello" else "" println(result) // hello ifEmpty だとスッキリする val result = dummyText.ifEmpty { "hello" } …
空白チェックを行う場合、if elseでもいいが、ifEmptyやifBlankでも便利にできる。 if elseの場合 val result = if (dummyText.isEmpty()) "hello" else "" println(result) // hello ifEmpty だとスッキリする val result = dummyText.ifEmpty { "hello" } …