Skip to content
Kotlin

kotlin.String API Reference

Kotlin's String — an immutable sequence of UTF-16 code units, enhanced with extension functions.

By EZ4Code Team

String

Represents a character sequence. Kotlin String is immutable and bridges to java.lang.String.

String.length: Int

Returns the length of this character sequence.

Returns: Int

String.uppercase(): String

Returns a string with all characters converted to uppercase using default locale rules.

Returns: String

String.lowercase(): String

Returns a string with all characters converted to lowercase using default locale rules.

Returns: String

String.split(vararg delimiters: String): List<String>

Splits this string around matches of the given delimiters.

Returns: List<String>

String.replace(oldValue: String, newValue: String): String

Returns a new string with all occurrences of oldValue replaced with newValue.

Returns: String

String.contains(other: CharSequence): Boolean

Returns true if this string contains the specified char sequence.

Returns: Boolean

String.trim(): String

Returns a string with leading and trailing whitespace removed.

Returns: String

String.startsWith(prefix: String): Boolean

Returns true if this string starts with the specified prefix.

Returns: Boolean

More Kotlin API References