isUpperCase

expect fun Char.isUpperCase(): Boolean

Returns true if this character is an upper case letter.

A character is considered to be an upper case letter if its category is CharCategory.UPPERCASE_LETTER.

Since Kotlin

1.5

Samples

import samples.*
import java.util.*
import kotlin.test.*
fun main() { 
   //sampleStart 
   val chars = listOf('A', 'Ψ', 'a', '1', '+')
val (upperCases, notUpperCases) = chars.partition { it.isUpperCase() }
assertPrints(upperCases, "[A, Ψ]")
assertPrints(notUpperCases, "[a, 1, +]") 
   //sampleEnd
}
actual inline fun Char.isUpperCase(): Boolean

Returns true if this character is upper case.

Samples

import samples.*
import java.util.*
import kotlin.test.*
fun main() { 
   //sampleStart 
   val chars = listOf('A', 'Ψ', 'a', '1', '+')
val (upperCases, notUpperCases) = chars.partition { it.isUpperCase() }
assertPrints(upperCases, "[A, Ψ]")
assertPrints(notUpperCases, "[a, 1, +]") 
   //sampleEnd
}

See also

actual fun Char.isUpperCase(): Boolean

Returns true if this character is an upper case letter.

A character is considered to be an upper case letter if its category is CharCategory.UPPERCASE_LETTER.

Since Kotlin

1.5

Samples

import samples.*
import java.util.*
import kotlin.test.*
fun main() { 
   //sampleStart 
   val chars = listOf('A', 'Ψ', 'a', '1', '+')
val (upperCases, notUpperCases) = chars.partition { it.isUpperCase() }
assertPrints(upperCases, "[A, Ψ]")
assertPrints(notUpperCases, "[a, 1, +]") 
   //sampleEnd
}
actual fun Char.isUpperCase(): Boolean

Returns true if this character is an upper case letter.

A character is considered to be an upper case letter if its category is CharCategory.UPPERCASE_LETTER.

Samples

import samples.*
import java.util.*
import kotlin.test.*
fun main() { 
   //sampleStart 
   val chars = listOf('A', 'Ψ', 'a', '1', '+')
val (upperCases, notUpperCases) = chars.partition { it.isUpperCase() }
assertPrints(upperCases, "[A, Ψ]")
assertPrints(notUpperCases, "[a, 1, +]") 
   //sampleEnd
}