Skip to content

Commit

Permalink
Add blank check to isDigitsOnly()
Browse files Browse the repository at this point in the history
  • Loading branch information
Sternbach-Software authored Jul 14, 2023
1 parent 4ebcaba commit b9d6cfa
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/kotlin/KotlinFunctionLibrary.kt
Original file line number Diff line number Diff line change
Expand Up @@ -644,9 +644,11 @@ println("workingList2=$workingList2")*/
}

/**
* Returns whether the given CharSequence contains only digits.
* Returns whether the given CharSequence contains only digits. Like [android.text.TextUtils], except returns
* false if blank.
*/
fun CharSequence.isDigitsOnly(): Boolean {
if(isBlank()) return false
var cp: Int
var i = 0
while (i < length) {
Expand Down

0 comments on commit b9d6cfa

Please sign in to comment.