Skip to content

Commit b9d6cfa

Browse files
Add blank check to isDigitsOnly()
1 parent 4ebcaba commit b9d6cfa

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/main/kotlin/KotlinFunctionLibrary.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,9 +644,11 @@ println("workingList2=$workingList2")*/
644644
}
645645

646646
/**
647-
* Returns whether the given CharSequence contains only digits.
647+
* Returns whether the given CharSequence contains only digits. Like [android.text.TextUtils], except returns
648+
* false if blank.
648649
*/
649650
fun CharSequence.isDigitsOnly(): Boolean {
651+
if(isBlank()) return false
650652
var cp: Int
651653
var i = 0
652654
while (i < length) {

0 commit comments

Comments
 (0)