isDigit
Returns true
if this character is a digit.
A character is considered to be a digit if its category is CharCategory.DECIMAL_DIGIT_NUMBER.
Returns true
if this character is a digit.
A character is considered to be a digit if its category is CharCategory.DECIMAL_DIGIT_NUMBER.
import java.util.* import kotlin.test.* fun main() { //sampleStart val chars = listOf('a', '+', '1') val (digits, notDigits) = chars.partition { it.isDigit() } println(digits) // [1] println(notDigits) // [a, +] //sampleEnd }
xxxxxxxxxx
val chars = listOf('a', '+', '1')
val (digits, notDigits) = chars.partition { it.isDigit() }
println(digits) // [1]
println(notDigits) // [a, +]
Thanks for your feedback!