uppercase

expect fun Char.uppercase(): String(source)

Converts this character to upper case using Unicode mapping rules of the invariant locale.

This function supports one-to-many character mapping, thus the length of the returned string can be greater than one. For example, '\uFB00'.uppercase() returns "\u0046\u0046", where '\uFB00' is the LATIN SMALL LIGATURE FF character (). If this character has no upper case mapping, the result of toString() of this char is returned.

Since Kotlin

1.5

Samples

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

fun main() { 
   //sampleStart 
   val chars = listOf('a', 'ω', '1', 'ʼn', 'A', '+', 'ß')
val uppercaseChar = chars.map { it.uppercaseChar() }
val uppercase = chars.map { it.uppercase() }
println(uppercaseChar) // [A, Ω, 1, ʼn, A, +, ß]
println(uppercase) // [A, Ω, 1, ʼN, A, +, SS] 
   //sampleEnd
}

expect fun String.uppercase(): String(source)

Returns a copy of this string converted to upper case using Unicode mapping rules of the invariant locale.

This function supports one-to-many and many-to-one character mapping, thus the length of the returned string can be different from the length of the original string.

Since Kotlin

1.5

Samples

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

fun main() { 
   //sampleStart 
   println("Iced frappé!".uppercase()) // ICED FRAPPÉ! 
   //sampleEnd
}
actual inline fun Char.uppercase(): String(source)

Converts this character to upper case using Unicode mapping rules of the invariant locale.

This function supports one-to-many character mapping, thus the length of the returned string can be greater than one. For example, '\uFB00'.uppercase() returns "\u0046\u0046", where '\uFB00' is the LATIN SMALL LIGATURE FF character (). If this character has no upper case mapping, the result of toString() of this char is returned.

Since Kotlin

1.5

Samples

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

fun main() { 
   //sampleStart 
   val chars = listOf('a', 'ω', '1', 'ʼn', 'A', '+', 'ß')
val uppercaseChar = chars.map { it.uppercaseChar() }
val uppercase = chars.map { it.uppercase() }
println(uppercaseChar) // [A, Ω, 1, ʼn, A, +, ß]
println(uppercase) // [A, Ω, 1, ʼN, A, +, SS] 
   //sampleEnd
}

actual inline fun String.uppercase(): String(source)

Returns a copy of this string converted to upper case using Unicode mapping rules of the invariant locale.

This function supports one-to-many and many-to-one character mapping, thus the length of the returned string can be different from the length of the original string.

Since Kotlin

1.5

Samples

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

fun main() { 
   //sampleStart 
   println("Iced frappé!".uppercase()) // ICED FRAPPÉ! 
   //sampleEnd
}

Converts this character to upper case using Unicode mapping rules of the specified locale.

This function supports one-to-many character mapping, thus the length of the returned string can be greater than one. For example, '\uFB00'.uppercase(Locale.US) returns "\u0046\u0046", where '\uFB00' is the LATIN SMALL LIGATURE FF character (). If this character has no upper case mapping, the result of toString() of this char is returned.

Since Kotlin

1.5

Samples

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

fun main() { 
   //sampleStart 
   val chars = listOf('a', '1', 'ʼn', 'A', '+', 'i')
val uppercase = chars.map { it.uppercase() }
val turkishLocale = Locale.forLanguageTag("tr")
val uppercaseTurkish = chars.map { it.uppercase(turkishLocale) }
println(uppercase) // [A, 1, ʼN, A, +, I]
println(uppercaseTurkish) // [A, 1, ʼN, A, +, İ] 
   //sampleEnd
}

inline fun String.uppercase(locale: Locale): String(source)

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

This function supports one-to-many and many-to-one character mapping, thus the length of the returned string can be different from the length of the original string.

Since Kotlin

1.5

Samples

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

fun main() { 
   //sampleStart 
   println("Kotlin".uppercase()) // KOTLIN
val turkishLocale = Locale.forLanguageTag("tr")
println("Kotlin".uppercase(turkishLocale)) // KOTLİN 
   //sampleEnd
}

actual inline fun Char.uppercase(): String(source)

Converts this character to upper case using Unicode mapping rules of the invariant locale.

This function supports one-to-many character mapping, thus the length of the returned string can be greater than one. For example, '\uFB00'.uppercase() returns "\u0046\u0046", where '\uFB00' is the LATIN SMALL LIGATURE FF character (). If this character has no upper case mapping, the result of toString() of this char is returned.

Since Kotlin

1.5

Samples

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

fun main() { 
   //sampleStart 
   val chars = listOf('a', 'ω', '1', 'ʼn', 'A', '+', 'ß')
val uppercaseChar = chars.map { it.uppercaseChar() }
val uppercase = chars.map { it.uppercase() }
println(uppercaseChar) // [A, Ω, 1, ʼn, A, +, ß]
println(uppercase) // [A, Ω, 1, ʼN, A, +, SS] 
   //sampleEnd
}

actual inline fun String.uppercase(): String(source)

Returns a copy of this string converted to upper case using Unicode mapping rules of the invariant locale.

This function supports one-to-many and many-to-one character mapping, thus the length of the returned string can be different from the length of the original string.

Since Kotlin

1.5

Samples

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

fun main() { 
   //sampleStart 
   println("Iced frappé!".uppercase()) // ICED FRAPPÉ! 
   //sampleEnd
}
actual fun Char.uppercase(): String(source)

Converts this character to upper case using Unicode mapping rules of the invariant locale.

This function supports one-to-many character mapping, thus the length of the returned string can be greater than one. For example, '\uFB00'.uppercase() returns "\u0046\u0046", where '\uFB00' is the LATIN SMALL LIGATURE FF character (). If this character has no upper case mapping, the result of toString() of this char is returned.

Since Kotlin

1.5

Samples

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

fun main() { 
   //sampleStart 
   val chars = listOf('a', 'ω', '1', 'ʼn', 'A', '+', 'ß')
val uppercaseChar = chars.map { it.uppercaseChar() }
val uppercase = chars.map { it.uppercase() }
println(uppercaseChar) // [A, Ω, 1, ʼn, A, +, ß]
println(uppercase) // [A, Ω, 1, ʼN, A, +, SS] 
   //sampleEnd
}

actual fun String.uppercase(): String(source)

Returns a copy of this string converted to upper case using Unicode mapping rules of the invariant locale.

This function supports one-to-many and many-to-one character mapping, thus the length of the returned string can be different from the length of the original string.

Since Kotlin

1.5

Samples

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

fun main() { 
   //sampleStart 
   println("Iced frappé!".uppercase()) // ICED FRAPPÉ! 
   //sampleEnd
}
actual fun Char.uppercase(): String(source)

Converts this character to upper case using Unicode mapping rules of the invariant locale.

This function supports one-to-many character mapping, thus the length of the returned string can be greater than one. For example, '\uFB00'.uppercase() returns "\u0046\u0046", where '\uFB00' is the LATIN SMALL LIGATURE FF character (). If this character has no upper case mapping, the result of toString() of this char is returned.

Since Kotlin

1.8

Samples

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

fun main() { 
   //sampleStart 
   val chars = listOf('a', 'ω', '1', 'ʼn', 'A', '+', 'ß')
val uppercaseChar = chars.map { it.uppercaseChar() }
val uppercase = chars.map { it.uppercase() }
println(uppercaseChar) // [A, Ω, 1, ʼn, A, +, ß]
println(uppercase) // [A, Ω, 1, ʼN, A, +, SS] 
   //sampleEnd
}

actual fun String.uppercase(): String(source)

Returns a copy of this string converted to upper case using Unicode mapping rules of the invariant locale.

This function supports one-to-many and many-to-one character mapping, thus the length of the returned string can be different from the length of the original string.

Since Kotlin

1.8

Samples

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

fun main() { 
   //sampleStart 
   println("Iced frappé!".uppercase()) // ICED FRAPPÉ! 
   //sampleEnd
}
actual fun Char.uppercase(): String(source)

Converts this character to upper case using Unicode mapping rules of the invariant locale.

This function supports one-to-many character mapping, thus the length of the returned string can be greater than one. For example, '\uFB00'.uppercase() returns "\u0046\u0046", where '\uFB00' is the LATIN SMALL LIGATURE FF character (). If this character has no upper case mapping, the result of toString() of this char is returned.

Since Kotlin

1.8

Samples

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

fun main() { 
   //sampleStart 
   val chars = listOf('a', 'ω', '1', 'ʼn', 'A', '+', 'ß')
val uppercaseChar = chars.map { it.uppercaseChar() }
val uppercase = chars.map { it.uppercase() }
println(uppercaseChar) // [A, Ω, 1, ʼn, A, +, ß]
println(uppercase) // [A, Ω, 1, ʼN, A, +, SS] 
   //sampleEnd
}

actual fun String.uppercase(): String(source)

Returns a copy of this string converted to upper case using Unicode mapping rules of the invariant locale.

This function supports one-to-many and many-to-one character mapping, thus the length of the returned string can be different from the length of the original string.

Since Kotlin

1.8

Samples

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

fun main() { 
   //sampleStart 
   println("Iced frappé!".uppercase()) // ICED FRAPPÉ! 
   //sampleEnd
}