Returns true
if this character is a digit.
A character is considered to be a digit if its category is CharCategory.DECIMAL_DIGIT_NUMBER.
Since Kotlin
1.0Samples
import java.util.*
import kotlin.test.*
fun main() {
val chars = listOf('a', '+', '1')
val (digits, notDigits) = chars.partition { it.isDigit() }
println(digits)
println(notDigits)
}
Target: JVMRunning on v.2.1.20
Returns true
if this character is a digit.
A character is considered to be a digit if its category is CharCategory.DECIMAL_DIGIT_NUMBER.
Since Kotlin
1.3Samples
import java.util.*
import kotlin.test.*
fun main() {
val chars = listOf('a', '+', '1')
val (digits, notDigits) = chars.partition { it.isDigit() }
println(digits)
println(notDigits)
}
Target: JVMRunning on v.2.1.20