[stdlib] Use more idiomatic and performant implementation of isBlank

Also replace expect-actual with a common function because its implementation is no longer different in different platforms.

KT-65590
This commit is contained in:
Ilya Gorbunov
2024-02-06 15:57:42 +01:00
committed by Space Team
parent 6f6496d78a
commit 15375c0fd5
6 changed files with 6 additions and 32 deletions
@@ -54,13 +54,6 @@ public fun String.matches(regex: String): Boolean {
return result != null && result.size != 0
}
/**
* Returns `true` if this string is empty or consists solely of whitespace characters.
*
* @sample samples.text.Strings.stringIsBlank
*/
public actual fun CharSequence.isBlank(): Boolean = length == 0 || indices.all { this[it].isWhitespace() }
/**
* Returns `true` if this string is equal to [other], optionally ignoring character case.
*