Add isEmpty, isBlank methods and their nullable and negating couterparts.

This commit is contained in:
Ilya Gorbunov
2015-03-31 18:31:45 +03:00
parent 4efb0dbf9a
commit ac4b207413
4 changed files with 71 additions and 3 deletions
+3
View File
@@ -28,6 +28,9 @@ public inline fun String.matches(regex : String) : Boolean {
return result != null && result.size() > 0
}
public fun String.isBlank(): Boolean = length() == 0 || matches("^[\\s\\xA0]+$")
public fun String.equals(anotherString: String, ignoreCase: Boolean = false): Boolean =
if (!ignoreCase)
this == anotherString