lowercase

Common
JVM
JS
Native
1.4
@ExperimentalStdlibApi fun Char.lowercase(): String

Converts this character to lower 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, '\u0130'.lowercase() returns "\u0069\u0307", where '\u0130' is the LATIN CAPITAL LETTER I WITH DOT ABOVE character (İ). If this character has no lower case mapping, the result of toString() of this char is returned.

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

fun main(args: Array<String>) {
//sampleStart
val chars = listOf('A', 'Ω', '1', 'a', '+', 'İ')
val lowercaseChar = chars.map { it.lowercaseChar() }
val lowercase = chars.map { it.lowercase() }
println(lowercaseChar) // [a, ω, 1, a, +, i]
println(lowercase) // [a, ω, 1, a, +, \u0069\u0307]
//sampleEnd
}
Common
JVM
JS
Native
1.4
@ExperimentalStdlibApi fun String.lowercase(): String

Returns a copy of this string converted to lower 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.

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

fun main(args: Array<String>) {
//sampleStart
println("Iced frappé!".lowercase()) // iced frappé!
//sampleEnd
}
JVM
1.4
@ExperimentalStdlibApi fun Char.lowercase(
    locale: Locale
): String

Converts this character to lower 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, '\u0130'.lowercase(Locale.US) returns "\u0069\u0307", where '\u0130' is the LATIN CAPITAL LETTER I WITH DOT ABOVE character (İ). If this character has no lower case mapping, the result of toString() of this char is returned.

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

fun main(args: Array<String>) {
//sampleStart
val chars = listOf('A', 'Ω', '1', 'a', '+', 'İ')
val lowercase = chars.map { it.lowercase() }
val turkishLocale = Locale.forLanguageTag("tr")
val lowercaseTurkish = chars.map { it.lowercase(turkishLocale) }
println(lowercase) // [a, ω, 1, a, +, \u0069\u0307]
println(lowercaseTurkish) // [a, ω, 1, a, +, i]
//sampleEnd
}
JVM
1.4
@ExperimentalStdlibApi fun String.lowercase(
    locale: Locale
): String

Returns a copy of this string converted to lower 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.

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

fun main(args: Array<String>) {
//sampleStart
println("KOTLIN".lowercase()) // kotlin
val turkishLocale = Locale.forLanguageTag("tr")
println("KOTLIN".lowercase(turkishLocale)) // kotlın
//sampleEnd
}