W3cubDocs

/Kotlin

toUpperCase

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
fun Char.toUpperCase(): Char
For JVM

Converts this character to uppercase.

import kotlin.test.*
import java.util.*

fun main(args: Array<String>) {
//sampleStart
val chars = listOf('a', 'ω', '1', 'A', '+')
val upperCases = chars.map { it.toUpperCase() }
println(upperCases) // [A, Ω, 1, A, +]
//sampleEnd
}
For Native

Converts this character to uppercase.

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
fun String.toUpperCase(): String
For Common, JVM, JS

Returns a copy of this string converted to upper case using the rules of the default locale.

import kotlin.test.*

fun main(args: Array<String>) {
//sampleStart
println("Iced frappé!".toUpperCase()) // ICED FRAPPÉ!
//sampleEnd
}
For Native

Returns a copy of this string converted to upper case using the rules of the default locale.

Platform and version requirements: JVM (1.0)
fun String.toUpperCase(locale: Locale): String

Returns a copy of this string converted to upper case using the rules of the specified locale.

© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/to-upper-case.html