...

/

Characters and Strings

Characters and Strings

Learn about Kotlin’s character and string manipulation, including Unicode, escape sequences, and formatting.

We'll cover the following...

Characters

To represent a single character, we use the Char type. We specify a character using single quotes (').

Press + to interact
fun main() {
println('A') // A
println('Z') // Z
}

Each character is represented as a Unicode number. To find out the Unicode of a character, we use the code property.

Press + to interact
fun main() {
println('A'.code) // 65
}

Kotlin accepts Unicode characters. To describe them by their code, we start ...