uppercase

expect fun Char.uppercase(): String

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 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() }
assertPrints(uppercaseChar, "[A, Ω, 1, ʼn, A, +, ß]")
assertPrints(uppercase, "[A, Ω, 1, ʼN, A, +, SS]") 
   //sampleEnd
}

expect fun String.uppercase(): String

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 samples.*
import java.util.Locale
import kotlin.test.*
fun main() { 
   //sampleStart 
   assertPrints("Iced frappé!".uppercase(), "ICED FRAPPÉ!") 
   //sampleEnd
}
fun Char.uppercase(locale: Locale): String

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 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) }
assertPrints(uppercase, "[A, 1, ʼN, A, +, I]")
assertPrints(uppercaseTurkish, "[A, 1, ʼN, A, +, İ]") 
   //sampleEnd
}

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

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 samples.*
import java.util.Locale
import kotlin.test.*
fun main() { 
   //sampleStart 
   assertPrints("Kotlin".uppercase(), "KOTLIN")
val turkishLocale = Locale.forLanguageTag("tr")
assertPrints("Kotlin".uppercase(turkishLocale), "KOTLİN") 
   //sampleEnd
}

actual inline fun Char.uppercase(): String

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 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() }
assertPrints(uppercaseChar, "[A, Ω, 1, ʼn, A, +, ß]")
assertPrints(uppercase, "[A, Ω, 1, ʼN, A, +, SS]") 
   //sampleEnd
}

actual inline fun String.uppercase(): String

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 samples.*
import java.util.Locale
import kotlin.test.*
fun main() { 
   //sampleStart 
   assertPrints("Iced frappé!".uppercase(), "ICED FRAPPÉ!") 
   //sampleEnd
}
actual inline fun Char.uppercase(): String

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 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() }
assertPrints(uppercaseChar, "[A, Ω, 1, ʼn, A, +, ß]")
assertPrints(uppercase, "[A, Ω, 1, ʼN, A, +, SS]") 
   //sampleEnd
}

actual inline fun String.uppercase(): String

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 samples.*
import java.util.Locale
import kotlin.test.*
fun main() { 
   //sampleStart 
   assertPrints("Iced frappé!".uppercase(), "ICED FRAPPÉ!") 
   //sampleEnd
}
actual fun Char.uppercase(): String

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 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() }
assertPrints(uppercaseChar, "[A, Ω, 1, ʼn, A, +, ß]")
assertPrints(uppercase, "[A, Ω, 1, ʼN, A, +, SS]") 
   //sampleEnd
}

actual fun String.uppercase(): String

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 samples.*
import java.util.Locale
import kotlin.test.*
fun main() { 
   //sampleStart 
   assertPrints("Iced frappé!".uppercase(), "ICED FRAPPÉ!") 
   //sampleEnd
}