Package kotlin.text

Functions for working with text and regular expressions.

Functions for working with text and regular expressions.

Functions for working with text and regular expressions.

Functions for working with text and regular expressions.

Functions for working with text and regular expressions.

Types

Appendable
Link copied to clipboard
expect interface Appendable

An object to which char sequences and values can be appended.

actual typealias Appendable = Appendable
actual interface Appendable

An object to which char sequences and values can be appended.

actual interface Appendable

An object to which char sequences and values can be appended.

CharacterCodingException
Link copied to clipboard
expect open class CharacterCodingException : Exception

The exception thrown when a character encoding or decoding error occurs.

Since Kotlin

1.4
actual typealias CharacterCodingException = CharacterCodingException
actual open class CharacterCodingException : Exception

The exception thrown when a character encoding or decoding error occurs.

Since Kotlin

1.4
actual open class CharacterCodingException : Exception

The exception thrown when a character encoding or decoding error occurs.

Since Kotlin

1.3
CharCategory
Link copied to clipboard
expect enum CharCategory : Enum<CharCategory>

Represents the character general category in the Unicode specification.

Since Kotlin

1.5
actual enum CharCategory : Enum<CharCategory>
actual enum CharCategory : Enum<CharCategory>
actual enum CharCategory : Enum<CharCategory>

Represents the character general category in the Unicode specification.

CharDirectionality
Link copied to clipboard
enum CharDirectionality : Enum<CharDirectionality>

Represents the Unicode directionality of a character. Character directionality is used to calculate the visual ordering of text.

Charsets
Link copied to clipboard
object Charsets

Constant definitions for the standard charsets. These charsets are guaranteed to be available on every implementation of the Java platform.

MatchGroup
Link copied to clipboard
expect class MatchGroup
actual data class MatchGroup

Represents the results from a single capturing group within a MatchResult of Regex.

actual data class MatchGroup

Represents the results from a single capturing group within a MatchResult of Regex.

actual data class MatchGroup

Represents the results from a single capturing group within a MatchResult of Regex.

MatchGroupCollection
Link copied to clipboard
interface MatchGroupCollection : Collection<MatchGroup?>

Represents a collection of captured groups in a single match of a regular expression.

MatchNamedGroupCollection
Link copied to clipboard
interface MatchNamedGroupCollection : MatchGroupCollection

Extends MatchGroupCollection by introducing a way to get matched groups by name, when regex supports it.

Since Kotlin

1.1
MatchResult
Link copied to clipboard
interface MatchResult

Represents the results from a single regular expression match.

Regex
Link copied to clipboard
expect class Regex(pattern: String, options: Set<RegexOption>)
actual class Regex(pattern: String, options: Set<RegexOption>) : Serializable

Represents a compiled regular expression. Provides functions to match strings in text with a pattern, replace the found occurrences and split text around matches.

actual class Regex(pattern: String, options: Set<RegexOption>)

Represents a compiled regular expression. Provides functions to match strings in text with a pattern, replace the found occurrences and split text around matches.

actual class Regex(pattern: String, options: Set<RegexOption>)

Represents a compiled regular expression. Provides functions to match strings in text with a pattern, replace the found occurrences and split text around matches.

RegexOption
Link copied to clipboard
expect enum RegexOption : Enum<RegexOption>
actual enum RegexOption : Enum<RegexOption> , FlagEnum

Provides enumeration values to use to set regular expression options.

actual enum RegexOption : Enum<RegexOption>

Provides enumeration values to use to set regular expression options.

actual enum RegexOption : Enum<RegexOption> , FlagEnum

Provides enumeration values to use to set regular expression options.

StringBuilder
Link copied to clipboard
expect class StringBuilder constructor(content: String) : Appendable, CharSequence

A mutable sequence of characters.

actual typealias StringBuilder = StringBuilder
actual class StringBuilder constructor(content: String) : Appendable, CharSequence

A mutable sequence of characters.

actual class StringBuilder constructor(content: String) : CharSequence, Appendable

A mutable sequence of characters.

Typography
Link copied to clipboard
object Typography

Defines names for Unicode symbols used in proper Typography.

Functions

all
Link copied to clipboard
inline fun CharSequence.all(predicate: (Char) -> Boolean): Boolean

Returns true if all characters match the given predicate.

any
Link copied to clipboard
fun CharSequence.any(): Boolean

Returns true if char sequence has at least one character.

inline fun CharSequence.any(predicate: (Char) -> Boolean): Boolean

Returns true if at least one character matches the given predicate.

append
Link copied to clipboard
fun <T : Appendable> T.append(vararg value: CharSequence?): T

Appends all arguments to the given Appendable.

inline fun StringBuilder.append(obj: Any?): StringBuilder

fun StringBuilder.append(vararg value: Any?): StringBuilder
fun StringBuilder.append(vararg value: String?): StringBuilder

Appends all arguments to the given StringBuilder.

inline fun StringBuilder.append(it: Boolean): StringBuilder
inline fun StringBuilder.append(it: Byte): StringBuilder
inline fun StringBuilder.append(it: CharArray): StringBuilder
inline fun StringBuilder.append(it: Double): StringBuilder
inline fun StringBuilder.append(it: Float): StringBuilder
inline fun StringBuilder.append(it: Int): StringBuilder
inline fun StringBuilder.append(it: Long): StringBuilder
inline fun StringBuilder.append(it: Short): StringBuilder
inline fun StringBuilder.append(it: String): StringBuilder
appendLine
Link copied to clipboard
inline fun Appendable.appendLine(): Appendable

Appends a line feed character (\n) to this Appendable.

Since Kotlin

1.4
inline fun StringBuilder.appendLine(): StringBuilder

Appends a line feed character (\n) to this StringBuilder.

Since Kotlin

1.4
inline fun Appendable.appendLine(value: Char): Appendable
inline fun Appendable.appendLine(value: CharSequence?): Appendable

Appends value to the given Appendable and a line feed character (\n) after it.

Since Kotlin

1.4
inline fun StringBuilder.appendLine(value: Any?): StringBuilder
inline fun StringBuilder.appendLine(value: Boolean): StringBuilder
inline fun StringBuilder.appendLine(value: Char): StringBuilder
inline fun StringBuilder.appendLine(value: CharArray): StringBuilder
inline fun StringBuilder.appendLine(value: CharSequence?): StringBuilder
inline fun StringBuilder.appendLine(value: String?): StringBuilder

Appends value to this StringBuilder, followed by a line feed character (\n).

Since Kotlin

1.4
inline fun StringBuilder.appendLine(value: StringBuffer?): StringBuilder
inline fun StringBuilder.appendLine(value: StringBuilder?): StringBuilder
inline fun StringBuilder.appendLine(value: Byte): StringBuilder
inline fun StringBuilder.appendLine(value: Double): StringBuilder
inline fun StringBuilder.appendLine(value: Float): StringBuilder
inline fun StringBuilder.appendLine(value: Int): StringBuilder
inline fun StringBuilder.appendLine(value: Long): StringBuilder
inline fun StringBuilder.appendLine(value: Short): StringBuilder

Appends value to this StringBuilder, followed by a line feed character (\n).

Since Kotlin

1.4
inline fun StringBuilder.appendLine(value: Byte): StringBuilder
inline fun StringBuilder.appendLine(value: Double): StringBuilder
inline fun StringBuilder.appendLine(value: Float): StringBuilder
inline fun StringBuilder.appendLine(value: Int): StringBuilder
inline fun StringBuilder.appendLine(value: Long): StringBuilder
inline fun StringBuilder.appendLine(value: Short): StringBuilder

Appends value to this StringBuilder, followed by a line feed character (\n).

Since Kotlin

1.4
appendln
Link copied to clipboard
fun Appendable.appendln(): Appendable

Appends a line separator to this Appendable.

fun StringBuilder.appendln(): StringBuilder

Appends a line separator to this StringBuilder.

inline fun Appendable.appendln(value: Char): Appendable
inline fun Appendable.appendln(value: CharSequence?): Appendable

Appends value to the given Appendable and line separator after it.

inline fun StringBuilder.appendln(value: StringBuffer?): StringBuilder
inline fun StringBuilder.appendln(value: StringBuilder?): StringBuilder
inline fun StringBuilder.appendln(value: Any?): StringBuilder
inline fun StringBuilder.appendln(value: Boolean): StringBuilder
inline fun StringBuilder.appendln(value: Byte): StringBuilder
inline fun StringBuilder.appendln(value: Char): StringBuilder
inline fun StringBuilder.appendln(value: CharArray): StringBuilder
inline fun StringBuilder.appendln(value: CharSequence?): StringBuilder
inline fun StringBuilder.appendln(value: Double): StringBuilder
inline fun StringBuilder.appendln(value: Float): StringBuilder
inline fun StringBuilder.appendln(value: Int): StringBuilder
inline fun StringBuilder.appendln(value: Long): StringBuilder
inline fun StringBuilder.appendln(value: Short): StringBuilder
inline fun StringBuilder.appendln(value: String?): StringBuilder

Appends value to this StringBuilder, followed by a line separator.

fun StringBuilder.appendln(): StringBuilder
fun StringBuilder.appendln(it: Any?): StringBuilder
fun StringBuilder.appendln(it: Boolean): StringBuilder
fun StringBuilder.appendln(it: Byte): StringBuilder
fun StringBuilder.appendln(it: Double): StringBuilder
fun StringBuilder.appendln(it: Float): StringBuilder
fun StringBuilder.appendln(it: Int): StringBuilder
fun StringBuilder.appendln(it: Long): StringBuilder
fun StringBuilder.appendln(it: Short): StringBuilder
fun StringBuilder.appendln(it: String): StringBuilder
appendRange
Link copied to clipboard
fun <T : Appendable> T.appendRange(value: CharSequence, startIndex: Int, endIndex: Int): T

Appends a subsequence of the specified character sequence value to this Appendable and returns this instance.

Since Kotlin

1.4
expect fun StringBuilder.appendRange(value: CharArray, startIndex: Int, endIndex: Int): StringBuilder

Appends characters in a subarray of the specified character array value to this string builder and returns this instance.

Since Kotlin

1.4
expect fun StringBuilder.appendRange(value: CharSequence, startIndex: Int, endIndex: Int): StringBuilder

Appends a subsequence of the specified character sequence value to this string builder and returns this instance.

Since Kotlin

1.4
actual inline fun StringBuilder.appendRange(value: CharArray, startIndex: Int, endIndex: Int): StringBuilder

Appends characters in a subarray of the specified character array value to this string builder and returns this instance.

Since Kotlin

1.4
actual inline fun StringBuilder.appendRange(value: CharSequence, startIndex: Int, endIndex: Int): StringBuilder

Appends a subsequence of the specified character sequence value to this string builder and returns this instance.

Since Kotlin

1.4
actual inline fun StringBuilder.appendRange(value: CharArray, startIndex: Int, endIndex: Int): StringBuilder

Appends characters in a subarray of the specified character array value to this string builder and returns this instance.

Since Kotlin

1.4
actual inline fun StringBuilder.appendRange(value: CharSequence, startIndex: Int, endIndex: Int): StringBuilder

Appends a subsequence of the specified character sequence value to this string builder and returns this instance.

Since Kotlin

1.4
asIterable
Link copied to clipboard
fun CharSequence.asIterable(): Iterable<Char>

Creates an Iterable instance that wraps the original char sequence returning its characters when being iterated.

asSequence
Link copied to clipboard
fun CharSequence.asSequence(): Sequence<Char>

Creates a Sequence instance that wraps the original char sequence returning its characters when being iterated.

associate
Link copied to clipboard
inline fun <K, V> CharSequence.associate(transform: (Char) -> Pair<K, V>): Map<K, V>

Returns a Map containing key-value pairs provided by transform function applied to characters of the given char sequence.

associateBy
Link copied to clipboard
inline fun <K> CharSequence.associateBy(keySelector: (Char) -> K): Map<K, Char>

Returns a Map containing the characters from the given char sequence indexed by the key returned from keySelector function applied to each character.

inline fun <K, V> CharSequence.associateBy(keySelector: (Char) -> K, valueTransform: (Char) -> V): Map<K, V>

Returns a Map containing the values provided by valueTransform and indexed by keySelector functions applied to characters of the given char sequence.

associateByTo
Link copied to clipboard
inline fun <K, M : MutableMap<in K, in Char>> CharSequence.associateByTo(destination: M, keySelector: (Char) -> K): M

Populates and returns the destination mutable map with key-value pairs, where key is provided by the keySelector function applied to each character of the given char sequence and value is the character itself.

inline fun <K, V, M : MutableMap<in K, in V>> CharSequence.associateByTo(destination: M, keySelector: (Char) -> K, valueTransform: (Char) -> V): M

Populates and returns the destination mutable map with key-value pairs, where key is provided by the keySelector function and and value is provided by the valueTransform function applied to characters of the given char sequence.

associateTo
Link copied to clipboard
inline fun <K, V, M : MutableMap<in K, in V>> CharSequence.associateTo(destination: M, transform: (Char) -> Pair<K, V>): M

Populates and returns the destination mutable map with key-value pairs provided by transform function applied to each character of the given char sequence.

associateWith
Link copied to clipboard
inline fun <V> CharSequence.associateWith(valueSelector: (Char) -> V): Map<Char, V>

Returns a Map where keys are characters from the given char sequence and values are produced by the valueSelector function applied to each character.

Since Kotlin

1.3
associateWithTo
Link copied to clipboard
inline fun <V, M : MutableMap<in Char, in V>> CharSequence.associateWithTo(destination: M, valueSelector: (Char) -> V): M

Populates and returns the destination mutable map with key-value pairs for each character of the given char sequence, where key is the character itself and value is provided by the valueSelector function applied to that key.

Since Kotlin

1.3
buildString
Link copied to clipboard
inline fun buildString(builderAction: StringBuilder.() -> Unit): String

Builds new string by populating newly created StringBuilder using provided builderAction and then converting it to String.

inline fun buildString(capacity: Int, builderAction: StringBuilder.() -> Unit): String

Builds new string by populating newly created StringBuilder initialized with the given capacity using provided builderAction and then converting it to String.

Since Kotlin

1.1
capitalize
Link copied to clipboard
@DeprecatedSinceKotlin(warningSince = "1.5")
expect fun String.capitalize(): String

Returns a copy of this string having its first letter titlecased using the rules of the default locale, or the original string if it's empty or already starts with a title case letter.

@DeprecatedSinceKotlin(warningSince = "1.5")
actual fun String.capitalize(): String

Returns a copy of this string having its first letter titlecased using the rules of the default locale, or the original string if it's empty or already starts with a title case letter.

@DeprecatedSinceKotlin(warningSince = "1.5")
fun String.capitalize(locale: Locale): String

Returns a copy of this string having its first letter titlecased using the rules of the specified locale, or the original string if it's empty or already starts with a title case letter.

Since Kotlin

1.4
@DeprecatedSinceKotlin(warningSince = "1.5")
actual fun String.capitalize(): String

Returns a copy of this string having its first letter titlecased using the rules of the default locale, or the original string if it's empty or already starts with a title case letter.

@DeprecatedSinceKotlin(warningSince = "1.5")
actual fun String.capitalize(): String

Returns a copy of this string having its first letter titlecased using the rules of the default locale, or the original string if it's empty or already starts with a title case letter.

charset
Link copied to clipboard
inline fun charset(charsetName: String): Charset

Returns a named charset with the given charsetName name.

chunked
Link copied to clipboard
fun CharSequence.chunked(size: Int): List<String>

Splits this char sequence into a list of strings each not exceeding the given size.

Since Kotlin

1.2
fun <R> CharSequence.chunked(size: Int, transform: (CharSequence) -> R): List<R>

Splits this char sequence into several char sequences each not exceeding the given size and applies the given transform function to an each.

Since Kotlin

1.2
chunkedSequence
Link copied to clipboard
fun CharSequence.chunkedSequence(size: Int): Sequence<String>

Splits this char sequence into a sequence of strings each not exceeding the given size.

Since Kotlin

1.2
fun <R> CharSequence.chunkedSequence(size: Int, transform: (CharSequence) -> R): Sequence<R>

Splits this char sequence into several char sequences each not exceeding the given size and applies the given transform function to an each.

Since Kotlin

1.2
clear
Link copied to clipboard
expect fun StringBuilder.clear(): StringBuilder

Clears the content of this string builder making it empty and returns this instance.

Since Kotlin

1.3
actual inline fun StringBuilder.clear(): StringBuilder

Clears the content of this string builder making it empty and returns this instance.

Since Kotlin

1.3
actual fun StringBuilder.clear(): StringBuilder

Clears the content of this string builder making it empty and returns this instance.

Since Kotlin

1.3
codePointAt
Link copied to clipboard
inline fun String.codePointAt(index: Int): Int

Returns the character (Unicode code point) at the specified index.

codePointBefore
Link copied to clipboard
inline fun String.codePointBefore(index: Int): Int

Returns the character (Unicode code point) before the specified index.

codePointCount
Link copied to clipboard
inline fun String.codePointCount(beginIndex: Int, endIndex: Int): Int

Returns the number of Unicode code points in the specified text range of this String.

commonPrefixWith
Link copied to clipboard
fun CharSequence.commonPrefixWith(other: CharSequence, ignoreCase: Boolean = false): String

Returns the longest string prefix such that this char sequence and other char sequence both start with this prefix, taking care not to split surrogate pairs. If this and other have no common prefix, returns the empty string.

commonSuffixWith
Link copied to clipboard
fun CharSequence.commonSuffixWith(other: CharSequence, ignoreCase: Boolean = false): String

Returns the longest string suffix such that this char sequence and other char sequence both end with this suffix, taking care not to split surrogate pairs. If this and other have no common suffix, returns the empty string.

compareTo
Link copied to clipboard
expect fun String.compareTo(other: String, ignoreCase: Boolean = false): Int

Compares two strings lexicographically, optionally ignoring case differences.

Since Kotlin

1.2
actual fun String.compareTo(other: String, ignoreCase: Boolean = false): Int

Compares two strings lexicographically, optionally ignoring case differences.

actual fun String.compareTo(other: String, ignoreCase: Boolean = false): Int
actual fun String.compareTo(other: String, ignoreCase: Boolean = false): Int
concat
Link copied to clipboard
inline fun String.concat(str: String): String
concatToString
Link copied to clipboard
expect fun CharArray.concatToString(): String

Concatenates characters in this CharArray into a String.

Since Kotlin

1.4
expect fun CharArray.concatToString(startIndex: Int = 0, endIndex: Int = this.size): String

Concatenates characters in this CharArray or its subrange into a String.

Since Kotlin

1.4
actual fun CharArray.concatToString(): String

Concatenates characters in this CharArray into a String.

Since Kotlin

1.4
actual fun CharArray.concatToString(startIndex: Int = 0, endIndex: Int = this.size): String

Concatenates characters in this CharArray or its subrange into a String.

Since Kotlin

1.4
actual fun CharArray.concatToString(): String

Concatenates characters in this CharArray into a String.

Since Kotlin

1.4
actual fun CharArray.concatToString(startIndex: Int = 0, endIndex: Int = this.size): String

Concatenates characters in this CharArray or its subrange into a String.

Since Kotlin

1.4
actual fun CharArray.concatToString(): String

Concatenates characters in this CharArray into a String.

Since Kotlin

1.3
actual fun CharArray.concatToString(startIndex: Int = 0, endIndex: Int = this.size): String

Concatenates characters in this CharArray or its subrange into a String.

Since Kotlin

1.3
contains
Link copied to clipboard
inline operator fun CharSequence.contains(regex: Regex): Boolean

Returns true if this char sequence contains at least one match of the specified regular expression regex.

operator fun CharSequence.contains(char: Char, ignoreCase: Boolean = false): Boolean

Returns true if this char sequence contains the specified character char.

operator fun CharSequence.contains(other: CharSequence, ignoreCase: Boolean = false): Boolean

Returns true if this char sequence contains the specified other sequence of characters as a substring.

contentEquals
Link copied to clipboard
expect infix fun CharSequence?.contentEquals(other: CharSequence?): Boolean

Returns true if the contents of this char sequence are equal to the contents of the specified other, i.e. both char sequences contain the same number of the same characters in the same order.

Since Kotlin

1.5
expect fun CharSequence?.contentEquals(other: CharSequence?, ignoreCase: Boolean): Boolean

Returns true if the contents of this char sequence are equal to the contents of the specified other, optionally ignoring case difference.

Since Kotlin

1.5
actual infix fun CharSequence?.contentEquals(other: CharSequence?): Boolean

Returns true if the contents of this char sequence are equal to the contents of the specified other, i.e. both char sequences contain the same number of the same characters in the same order.

Since Kotlin

1.5
inline fun String.contentEquals(stringBuilder: StringBuffer): Boolean

Returns true if this string is equal to the contents of the specified StringBuffer, false otherwise.

inline fun String.contentEquals(charSequence: CharSequence): Boolean

Returns true if this string is equal to the contents of the specified CharSequence, false otherwise.

actual fun CharSequence?.contentEquals(other: CharSequence?, ignoreCase: Boolean): Boolean

Returns true if the contents of this char sequence are equal to the contents of the specified other, optionally ignoring case difference.

Since Kotlin

1.5
actual infix fun CharSequence?.contentEquals(other: CharSequence?): Boolean

Returns true if the contents of this char sequence are equal to the contents of the specified other, i.e. both char sequences contain the same number of the same characters in the same order.

Since Kotlin

1.5
actual fun CharSequence?.contentEquals(other: CharSequence?, ignoreCase: Boolean): Boolean

Returns true if the contents of this char sequence are equal to the contents of the specified other, optionally ignoring case difference.

Since Kotlin

1.5
actual infix fun CharSequence?.contentEquals(other: CharSequence?): Boolean

Returns true if the contents of this char sequence are equal to the contents of the specified other, i.e. both char sequences contain the same number of the same characters in the same order.

Since Kotlin

1.5
actual fun CharSequence?.contentEquals(other: CharSequence?, ignoreCase: Boolean): Boolean

Returns true if the contents of this char sequence are equal to the contents of the specified other, optionally ignoring case difference.

Since Kotlin

1.5
count
Link copied to clipboard
inline fun CharSequence.count(): Int

Returns the length of this char sequence.

inline fun CharSequence.count(predicate: (Char) -> Boolean): Int

Returns the number of characters matching the given predicate.

decapitalize
Link copied to clipboard
@DeprecatedSinceKotlin(warningSince = "1.5")
expect fun String.decapitalize(): String

Returns a copy of this string having its first letter lowercased using the rules of the default locale, or the original string if it's empty or already starts with a lower case letter.

@DeprecatedSinceKotlin(warningSince = "1.5")
actual fun String.decapitalize(): String

Returns a copy of this string having its first letter lowercased using the rules of the default locale, or the original string if it's empty or already starts with a lower case letter.

@DeprecatedSinceKotlin(warningSince = "1.5")
fun String.decapitalize(locale: Locale): String

Returns a copy of this string having its first letter lowercased using the rules of the specified locale, or the original string, if it's empty or already starts with a lower case letter.

Since Kotlin

1.4
@DeprecatedSinceKotlin(warningSince = "1.5")
actual fun String.decapitalize(): String

Returns a copy of this string having its first letter lowercased using the rules of the default locale, or the original string if it's empty or already starts with a lower case letter.

@DeprecatedSinceKotlin(warningSince = "1.5")
actual fun String.decapitalize(): String

Returns a copy of this string having its first letter lowercased using the rules of the default locale, or the original string if it's empty or already starts with a lower case letter.

decodeToString
Link copied to clipboard
expect fun ByteArray.decodeToString(): String

Decodes a string from the bytes in UTF-8 encoding in this array.

Since Kotlin

1.4
expect fun ByteArray.decodeToString(startIndex: Int = 0, endIndex: Int = this.size, throwOnInvalidSequence: Boolean = false): String

Decodes a string from the bytes in UTF-8 encoding in this array or its subrange.

Since Kotlin

1.4
actual fun ByteArray.decodeToString(): String

Decodes a string from the bytes in UTF-8 encoding in this array.

Since Kotlin

1.4
actual fun ByteArray.decodeToString(startIndex: Int = 0, endIndex: Int = this.size, throwOnInvalidSequence: Boolean = false): String

Decodes a string from the bytes in UTF-8 encoding in this array or its subrange.

Since Kotlin

1.4
actual fun ByteArray.decodeToString(): String

Decodes a string from the bytes in UTF-8 encoding in this array.

Since Kotlin

1.4
actual fun ByteArray.decodeToString(startIndex: Int = 0, endIndex: Int = this.size, throwOnInvalidSequence: Boolean = false): String

Decodes a string from the bytes in UTF-8 encoding in this array or its subrange.

Since Kotlin

1.4
actual fun ByteArray.decodeToString(): String

Decodes a string from the bytes in UTF-8 encoding in this array.

Since Kotlin

1.3
actual fun ByteArray.decodeToString(startIndex: Int = 0, endIndex: Int = this.size, throwOnInvalidSequence: Boolean = false): String

Decodes a string from the bytes in UTF-8 encoding in this array or its subrange.

Since Kotlin

1.3
deleteAt
Link copied to clipboard
expect fun StringBuilder.deleteAt(index: Int): StringBuilder

Removes the character at the specified index from this string builder and returns this instance.

Since Kotlin

1.4
actual inline fun StringBuilder.deleteAt(index: Int): StringBuilder

Removes the character at the specified index from this string builder and returns this instance.

Since Kotlin

1.4
actual inline fun StringBuilder.deleteAt(index: Int): StringBuilder

Removes the character at the specified index from this string builder and returns this instance.

Since Kotlin

1.4
deleteCharAt
Link copied to clipboard
inline fun StringBuilder.deleteCharAt(index: Int): StringBuilder

Removes the character at the specified index from this string builder and returns this instance.

deleteRange
Link copied to clipboard
expect fun StringBuilder.deleteRange(startIndex: Int, endIndex: Int): StringBuilder

Removes characters in the specified range from this string builder and returns this instance.

Since Kotlin

1.4
actual inline fun StringBuilder.deleteRange(startIndex: Int, endIndex: Int): StringBuilder

Removes characters in the specified range from this string builder and returns this instance.

Since Kotlin

1.4
actual inline fun StringBuilder.deleteRange(startIndex: Int, endIndex: Int): StringBuilder

Removes characters in the specified range from this string builder and returns this instance.

Since Kotlin

1.4
digitToChar
Link copied to clipboard
fun Int.digitToChar(): Char

Returns the Char that represents this decimal digit. Throws an exception if this value is not in the range 0..9.

Since Kotlin

1.5
fun Int.digitToChar(radix: Int): Char

Returns the Char that represents this numeric digit value in the specified radix. Throws an exception if the radix is not in the range 2..36 or if this value is not in the range 0 until radix.

Since Kotlin

1.5
digitToInt
Link copied to clipboard
fun Char.digitToInt(): Int

Returns the numeric value of the decimal digit that this Char represents. Throws an exception if this Char is not a valid decimal digit.

Since Kotlin

1.5
fun Char.digitToInt(radix: Int): Int

Returns the numeric value of the digit that this Char represents in the specified radix. Throws an exception if the radix is not in the range 2..36 or if this Char is not a valid digit in the specified radix.

Since Kotlin

1.5
digitToIntOrNull
Link copied to clipboard
fun Char.digitToIntOrNull(): Int?

Returns the numeric value of the decimal digit that this Char represents, or null if this Char is not a valid decimal digit.

Since Kotlin

1.5
fun Char.digitToIntOrNull(radix: Int): Int?

Returns the numeric value of the digit that this Char represents in the specified radix, or null if this Char is not a valid digit in the specified radix. Throws an exception if the radix is not in the range 2..36.

Since Kotlin

1.5
drop
Link copied to clipboard
fun CharSequence.drop(n: Int): CharSequence

Returns a subsequence of this char sequence with the first n characters removed.

fun String.drop(n: Int): String

Returns a string with the first n characters removed.

dropLast
Link copied to clipboard
fun CharSequence.dropLast(n: Int): CharSequence

Returns a subsequence of this char sequence with the last n characters removed.

fun String.dropLast(n: Int): String

Returns a string with the last n characters removed.

dropLastWhile
Link copied to clipboard
inline fun CharSequence.dropLastWhile(predicate: (Char) -> Boolean): CharSequence

Returns a subsequence of this char sequence containing all characters except last characters that satisfy the given predicate.

inline fun String.dropLastWhile(predicate: (Char) -> Boolean): String

Returns a string containing all characters except last characters that satisfy the given predicate.

dropWhile
Link copied to clipboard
inline fun CharSequence.dropWhile(predicate: (Char) -> Boolean): CharSequence

Returns a subsequence of this char sequence containing all characters except first characters that satisfy the given predicate.

inline fun String.dropWhile(predicate: (Char) -> Boolean): String

Returns a string containing all characters except first characters that satisfy the given predicate.

elementAt
Link copied to clipboard
expect fun CharSequence.elementAt(index: Int): Char

Returns a character at the given index or throws an IndexOutOfBoundsException if the index is out of bounds of this char sequence.

actual inline fun CharSequence.elementAt(index: Int): Char

Returns a character at the given index or throws an IndexOutOfBoundsException if the index is out of bounds of this char sequence.

actual fun CharSequence.elementAt(index: Int): Char

Returns a character at the given index or throws an IndexOutOfBoundsException if the index is out of bounds of this char sequence.

actual inline fun CharSequence.elementAt(index: Int): Char

Returns a character at the given index or throws an IndexOutOfBoundsException if the index is out of bounds of this char sequence.

elementAtOrElse
Link copied to clipboard
inline fun CharSequence.elementAtOrElse(index: Int, defaultValue: (Int) -> Char): Char

Returns a character at the given index or the result of calling the defaultValue function if the index is out of bounds of this char sequence.

elementAtOrNull
Link copied to clipboard
inline fun CharSequence.elementAtOrNull(index: Int): Char?

Returns a character at the given index or null if the index is out of bounds of this char sequence.

encodeToByteArray
Link copied to clipboard
expect fun String.encodeToByteArray(): ByteArray

Encodes this string to an array of bytes in UTF-8 encoding.

Since Kotlin

1.4
expect fun String.encodeToByteArray(startIndex: Int = 0, endIndex: Int = this.length, throwOnInvalidSequence: Boolean = false): ByteArray

Encodes this string or its substring to an array of bytes in UTF-8 encoding.

Since Kotlin

1.4
actual fun String.encodeToByteArray(): ByteArray

Encodes this string to an array of bytes in UTF-8 encoding.

Since Kotlin

1.4
actual fun String.encodeToByteArray(startIndex: Int = 0, endIndex: Int = this.length, throwOnInvalidSequence: Boolean = false): ByteArray

Encodes this string or its substring to an array of bytes in UTF-8 encoding.

Since Kotlin

1.4
actual fun String.encodeToByteArray(): ByteArray

Encodes this string to an array of bytes in UTF-8 encoding.

Since Kotlin

1.4
actual fun String.encodeToByteArray(startIndex: Int = 0, endIndex: Int = this.length, throwOnInvalidSequence: Boolean = false): ByteArray

Encodes this string or its substring to an array of bytes in UTF-8 encoding.

Since Kotlin

1.4
actual fun String.encodeToByteArray(): ByteArray

Encodes this string to an array of bytes in UTF-8 encoding.

Since Kotlin

1.3
actual fun String.encodeToByteArray(startIndex: Int = 0, endIndex: Int = this.length, throwOnInvalidSequence: Boolean = false): ByteArray

Encodes this string or its substring to an array of bytes in UTF-8 encoding.

Since Kotlin

1.3
endsWith
Link copied to clipboard
fun CharSequence.endsWith(char: Char, ignoreCase: Boolean = false): Boolean

Returns true if this char sequence ends with the specified character.

fun CharSequence.endsWith(suffix: CharSequence, ignoreCase: Boolean = false): Boolean

Returns true if this char sequence ends with the specified suffix.

expect fun String.endsWith(suffix: String, ignoreCase: Boolean = false): Boolean
actual fun String.endsWith(suffix: String, ignoreCase: Boolean = false): Boolean

Returns true if this string ends with the specified suffix.

actual fun String.endsWith(suffix: String, ignoreCase: Boolean = false): Boolean

Returns true if this string ends with the specified suffix.

actual fun String.endsWith(suffix: String, ignoreCase: Boolean = false): Boolean

Returns true if this string ends with the specified suffix.

ensureCapacity
Link copied to clipboard
inline fun StringBuilder.ensureCapacity(capacity: Int)
equals
Link copied to clipboard
fun Char.equals(other: Char, ignoreCase: Boolean = false): Boolean

Returns true if this character is equal to the other character, optionally ignoring character case.

expect fun String?.equals(other: String?, ignoreCase: Boolean = false): Boolean

Returns true if this string is equal to other, optionally ignoring character case.

actual fun String?.equals(other: String?, ignoreCase: Boolean = false): Boolean

Returns true if this string is equal to other, optionally ignoring character case.

actual fun String?.equals(other: String?, ignoreCase: Boolean = false): Boolean
actual fun String?.equals(other: String?, ignoreCase: Boolean = false): Boolean

Returns true if this string is equal to other, optionally ignoring character case.

filter
Link copied to clipboard
inline fun CharSequence.filter(predicate: (Char) -> Boolean): CharSequence

Returns a char sequence containing only those characters from the original char sequence that match the given predicate.

inline fun String.filter(predicate: (Char) -> Boolean): String

Returns a string containing only those characters from the original string that match the given predicate.

filterIndexed
Link copied to clipboard
inline fun CharSequence.filterIndexed(predicate: (index: Int, Char) -> Boolean): CharSequence

Returns a char sequence containing only those characters from the original char sequence that match the given predicate.

inline fun String.filterIndexed(predicate: (index: Int, Char) -> Boolean): String

Returns a string containing only those characters from the original string that match the given predicate.

filterIndexedTo
Link copied to clipboard
inline fun <C : Appendable> CharSequence.filterIndexedTo(destination: C, predicate: (index: Int, Char) -> Boolean): C

Appends all characters matching the given predicate to the given destination.

filterNot
Link copied to clipboard
inline fun CharSequence.filterNot(predicate: (Char) -> Boolean): CharSequence

Returns a char sequence containing only those characters from the original char sequence that do not match the given predicate.

inline fun String.filterNot(predicate: (Char) -> Boolean): String

Returns a string containing only those characters from the original string that do not match the given predicate.

filterNotTo
Link copied to clipboard
inline fun <C : Appendable> CharSequence.filterNotTo(destination: C, predicate: (Char) -> Boolean): C

Appends all characters not matching the given predicate to the given destination.

filterTo
Link copied to clipboard
inline fun <C : Appendable> CharSequence.filterTo(destination: C, predicate: (Char) -> Boolean): C

Appends all characters matching the given predicate to the given destination.

find
Link copied to clipboard
inline fun CharSequence.find(predicate: (Char) -> Boolean): Char?

Returns the first character matching the given predicate, or null if no such character was found.

findAnyOf
Link copied to clipboard
fun CharSequence.findAnyOf(strings: Collection<String>, startIndex: Int = 0, ignoreCase: Boolean = false): Pair<Int, String>?

Finds the first occurrence of any of the specified strings in this char sequence, starting from the specified startIndex and optionally ignoring the case.

findLast
Link copied to clipboard
inline fun CharSequence.findLast(predicate: (Char) -> Boolean): Char?

Returns the last character matching the given predicate, or null if no such character was found.

findLastAnyOf
Link copied to clipboard
fun CharSequence.findLastAnyOf(strings: Collection<String>, startIndex: Int = lastIndex, ignoreCase: Boolean = false): Pair<Int, String>?

Finds the last occurrence of any of the specified strings in this char sequence, starting from the specified startIndex and optionally ignoring the case.

first
Link copied to clipboard
fun CharSequence.first(): Char

Returns first character.

inline fun CharSequence.first(predicate: (Char) -> Boolean): Char

Returns the first character matching the given predicate.

firstNotNullOf
Link copied to clipboard
inline fun <R : Any> CharSequence.firstNotNullOf(transform: (Char) -> R?): R

Returns the first non-null value produced by transform function being applied to characters of this char sequence in iteration order, or throws NoSuchElementException if no non-null value was produced.

Since Kotlin

1.5
firstNotNullOfOrNull
Link copied to clipboard
inline fun <R : Any> CharSequence.firstNotNullOfOrNull(transform: (Char) -> R?): R?

Returns the first non-null value produced by transform function being applied to characters of this char sequence in iteration order, or null if no non-null value was produced.

Since Kotlin

1.5
firstOrNull
Link copied to clipboard
fun CharSequence.firstOrNull(): Char?

Returns the first character, or null if the char sequence is empty.

inline fun CharSequence.firstOrNull(predicate: (Char) -> Boolean): Char?

Returns the first character matching the given predicate, or null if character was not found.

flatMap
Link copied to clipboard
inline fun <R> CharSequence.flatMap(transform: (Char) -> Iterable<R>): List<R>

Returns a single list of all elements yielded from results of transform function being invoked on each character of original char sequence.

flatMapIndexed
Link copied to clipboard
@JvmName(name = "flatMapIndexedIterable")
inline fun <R> CharSequence.flatMapIndexed(transform: (index: Int, Char) -> Iterable<R>): List<R>

Returns a single list of all elements yielded from results of transform function being invoked on each character and its index in the original char sequence.

Since Kotlin

1.4
flatMapIndexedTo
Link copied to clipboard
@JvmName(name = "flatMapIndexedIterableTo")
inline fun <R, C : MutableCollection<in R>> CharSequence.flatMapIndexedTo(destination: C, transform: (index: Int, Char) -> Iterable<R>): C

Appends all elements yielded from results of transform function being invoked on each character and its index in the original char sequence, to the given destination.

Since Kotlin

1.4
flatMapTo
Link copied to clipboard
inline fun <R, C : MutableCollection<in R>> CharSequence.flatMapTo(destination: C, transform: (Char) -> Iterable<R>): C

Appends all elements yielded from results of transform function being invoked on each character of original char sequence, to the given destination.

fold
Link copied to clipboard
inline fun <R> CharSequence.fold(initial: R, operation: (R, Char) -> R): R

Accumulates value starting with initial value and applying operation from left to right to current accumulator value and each character.

foldIndexed
Link copied to clipboard
inline fun <R> CharSequence.foldIndexed(initial: R, operation: (index: Int, R, Char) -> R): R

Accumulates value starting with initial value and applying operation from left to right to current accumulator value and each character with its index in the original char sequence.

foldRight
Link copied to clipboard
inline fun <R> CharSequence.foldRight(initial: R, operation: (Char, R) -> R): R

Accumulates value starting with initial value and applying operation from right to left to each character and current accumulator value.

foldRightIndexed
Link copied to clipboard
inline fun <R> CharSequence.foldRightIndexed(initial: R, operation: (index: Int, Char, R) -> R): R

Accumulates value starting with initial value and applying operation from right to left to each character with its index in the original char sequence and current accumulator value.

forEach
Link copied to clipboard
inline fun CharSequence.forEach(action: (Char) -> Unit)

Performs the given action on each character.

forEachIndexed
Link copied to clipboard
inline fun CharSequence.forEachIndexed(action: (index: Int, Char) -> Unit)

Performs the given action on each character, providing sequential index with the character.

format
Link copied to clipboard
inline fun String.format(vararg args: Any?): String

Uses this string as a format string and returns a string obtained by substituting the specified arguments, using the default locale.

@DeprecatedSinceKotlin(hiddenSince = "1.4")
inline fun String.format(locale: Locale, vararg args: Any?): String

Uses this string as a format string and returns a string obtained by substituting the specified arguments, using the specified locale.

@JvmName(name = "formatNullable")
inline fun String.format(locale: Locale?, vararg args: Any?): String

Uses this string as a format string and returns a string obtained by substituting the specified arguments, using the specified locale. If locale is null then no localization is applied.

Since Kotlin

1.4
inline fun String.Companion.format(format: String, vararg args: Any?): String

Uses the provided format as a format string and returns a string obtained by substituting the specified arguments, using the default locale.

@DeprecatedSinceKotlin(hiddenSince = "1.4")
inline fun String.Companion.format(locale: Locale, format: String, vararg args: Any?): String

Uses the provided format as a format string and returns a string obtained by substituting the specified arguments, using the specified locale.

@JvmName(name = "formatNullable")
inline fun String.Companion.format(locale: Locale?, format: String, vararg args: Any?): String

Uses the provided format as a format string and returns a string obtained by substituting the specified arguments, using the specified locale. If locale is null then no localization is applied.

Since Kotlin

1.4
get
Link copied to clipboard
operator fun MatchGroupCollection.get(name: String): MatchGroup?

Returns a named group with the specified name.

Since Kotlin

1.2
getOrElse
Link copied to clipboard
inline fun CharSequence.getOrElse(index: Int, defaultValue: (Int) -> Char): Char

Returns a character at the given index or the result of calling the defaultValue function if the index is out of bounds of this char sequence.

getOrNull
Link copied to clipboard
fun CharSequence.getOrNull(index: Int): Char?

Returns a character at the given index or null if the index is out of bounds of this char sequence.

groupBy
Link copied to clipboard
inline fun <K> CharSequence.groupBy(keySelector: (Char) -> K): Map<K, List<Char>>

Groups characters of the original char sequence by the key returned by the given keySelector function applied to each character and returns a map where each group key is associated with a list of corresponding characters.

inline fun <K, V> CharSequence.groupBy(keySelector: (Char) -> K, valueTransform: (Char) -> V): Map<K, List<V>>

Groups values returned by the valueTransform function applied to each character of the original char sequence by the key returned by the given keySelector function applied to the character and returns a map where each group key is associated with a list of corresponding values.

groupByTo
Link copied to clipboard
inline fun <K, M : MutableMap<in K, MutableList<Char>>> CharSequence.groupByTo(destination: M, keySelector: (Char) -> K): M

Groups characters of the original char sequence by the key returned by the given keySelector function applied to each character and puts to the destination map each group key associated with a list of corresponding characters.

inline fun <K, V, M : MutableMap<in K, MutableList<V>>> CharSequence.groupByTo(destination: M, keySelector: (Char) -> K, valueTransform: (Char) -> V): M

Groups values returned by the valueTransform function applied to each character of the original char sequence by the key returned by the given keySelector function applied to the character and puts to the destination map each group key associated with a list of corresponding values.

groupingBy
Link copied to clipboard
inline fun <K> CharSequence.groupingBy(crossinline keySelector: (Char) -> K): Grouping<Char, K>

Creates a Grouping source from a char sequence to be used later with one of group-and-fold operations using the specified keySelector function to extract a key from each character.

Since Kotlin

1.1
hasSurrogatePairAt
Link copied to clipboard
fun CharSequence.hasSurrogatePairAt(index: Int): Boolean

Returns true if this CharSequence has Unicode surrogate pair at the specified index.

ifBlank
Link copied to clipboard
inline fun <C : CharSequence, R, R> C.ifBlank(defaultValue: () -> R): R

Returns this char sequence if it is not empty and doesn't consist solely of whitespace characters, or the result of calling defaultValue function otherwise.

Since Kotlin

1.3
ifEmpty
Link copied to clipboard
inline fun <C : CharSequence, R, R> C.ifEmpty(defaultValue: () -> R): R

Returns this char sequence if it's not empty or the result of calling defaultValue function if the char sequence is empty.

Since Kotlin

1.3
indexOf
Link copied to clipboard
fun CharSequence.indexOf(char: Char, startIndex: Int = 0, ignoreCase: Boolean = false): Int

Returns the index within this string of the first occurrence of the specified character, starting from the specified startIndex.

fun CharSequence.indexOf(string: String, startIndex: Int = 0, ignoreCase: Boolean = false): Int

Returns the index within this char sequence of the first occurrence of the specified string, starting from the specified startIndex.

indexOfAny
Link copied to clipboard
fun CharSequence.indexOfAny(chars: CharArray, startIndex: Int = 0, ignoreCase: Boolean = false): Int

Finds the index of the first occurrence of any of the specified chars in this char sequence, starting from the specified startIndex and optionally ignoring the case.

fun CharSequence.indexOfAny(strings: Collection<String>, startIndex: Int = 0, ignoreCase: Boolean = false): Int

Finds the index of the first occurrence of any of the specified strings in this char sequence, starting from the specified startIndex and optionally ignoring the case.

indexOfFirst
Link copied to clipboard
inline fun CharSequence.indexOfFirst(predicate: (Char) -> Boolean): Int

Returns index of the first character matching the given predicate, or -1 if the char sequence does not contain such character.

indexOfLast
Link copied to clipboard
inline fun CharSequence.indexOfLast(predicate: (Char) -> Boolean): Int

Returns index of the last character matching the given predicate, or -1 if the char sequence does not contain such character.

insert
Link copied to clipboard
inline fun StringBuilder.insert(index: Int, c: Char): StringBuilder
inline fun StringBuilder.insert(index: Int, chars: CharArray): StringBuilder
inline fun StringBuilder.insert(index: Int, csq: CharSequence?): StringBuilder
inline fun StringBuilder.insert(index: Int, string: String): StringBuilder

inline fun StringBuilder.insert(index: Int, csq: CharSequence?, start: Int, end: Int): StringBuilder

Inserts characters in a subsequence of the specified character sequence csq into this string builder at the specified index and returns this instance.

insertRange
Link copied to clipboard
expect fun StringBuilder.insertRange(index: Int, value: CharArray, startIndex: Int, endIndex: Int): StringBuilder

Inserts characters in a subarray of the specified character array value into this string builder at the specified index and returns this instance.

Since Kotlin

1.4
expect fun StringBuilder.insertRange(index: Int, value: CharSequence, startIndex: Int, endIndex: Int): StringBuilder

Inserts characters in a subsequence of the specified character sequence value into this string builder at the specified index and returns this instance.

Since Kotlin

1.4
actual inline fun StringBuilder.insertRange(index: Int, value: CharArray, startIndex: Int, endIndex: Int): StringBuilder

Inserts characters in a subarray of the specified character array value into this string builder at the specified index and returns this instance.

Since Kotlin

1.4
actual inline fun StringBuilder.insertRange(index: Int, value: CharSequence, startIndex: Int, endIndex: Int): StringBuilder

Inserts characters in a subsequence of the specified character sequence value into this string builder at the specified index and returns this instance.

Since Kotlin

1.4
actual inline fun StringBuilder.insertRange(index: Int, value: CharArray, startIndex: Int, endIndex: Int): StringBuilder

Inserts characters in a subarray of the specified character array value into this string builder at the specified index and returns this instance.

Since Kotlin

1.4
actual inline fun StringBuilder.insertRange(index: Int, value: CharSequence, startIndex: Int, endIndex: Int): StringBuilder

Inserts characters in a subsequence of the specified character sequence value into this string builder at the specified index and returns this instance.

Since Kotlin

1.4
intern
Link copied to clipboard
inline fun String.intern(): String

Returns a canonical representation for this string object.

isBlank
Link copied to clipboard
expect fun CharSequence.isBlank(): Boolean
actual fun CharSequence.isBlank(): Boolean

Returns true if this string is empty or consists solely of whitespace characters.

actual fun CharSequence.isBlank(): Boolean
actual fun CharSequence.isBlank(): Boolean

Returns true if this string is empty or consists solely of whitespace characters.

isDefined
Link copied to clipboard
expect fun Char.isDefined(): Boolean

Returns true if this character (Unicode code point) is defined in Unicode.

Since Kotlin

1.5
actual inline fun Char.isDefined(): Boolean

Returns true if this character (Unicode code point) is defined in Unicode.

actual fun Char.isDefined(): Boolean

Returns true if this character (Unicode code point) is defined in Unicode.

Since Kotlin

1.5
actual fun Char.isDefined(): Boolean

Returns true if this character (Unicode code point) is defined in Unicode.

isDigit
Link copied to clipboard
expect fun Char.isDigit(): Boolean

Returns true if this character is a digit.

Since Kotlin

1.5
actual inline fun Char.isDigit(): Boolean

Returns true if this character is a digit.

actual fun Char.isDigit(): Boolean

Returns true if this character is a digit.

Since Kotlin

1.5
actual fun Char.isDigit(): Boolean

Returns true if this character is a digit.

isEmpty
Link copied to clipboard
inline fun CharSequence.isEmpty(): Boolean

Returns true if this char sequence is empty (contains no characters).

isHighSurrogate
Link copied to clipboard
expect fun Char.isHighSurrogate(): Boolean
actual inline fun Char.isHighSurrogate(): Boolean

Returns true if this character is a Unicode high-surrogate code unit (also known as leading-surrogate code unit).

actual fun Char.isHighSurrogate(): Boolean

Returns true if this character is a Unicode high-surrogate code unit (also known as leading-surrogate code unit).

actual external fun Char.isHighSurrogate(): Boolean

Returns true if this character is a Unicode high-surrogate code unit (also known as leading-surrogate code unit).

isIdentifierIgnorable
Link copied to clipboard
inline fun Char.isIdentifierIgnorable(): Boolean

Returns true if this character (Unicode code point) should be regarded as an ignorable character in a Java identifier or a Unicode identifier.

external fun Char.isIdentifierIgnorable(): Boolean

Returns true if this character (Unicode code point) should be regarded as an ignorable character in a Java identifier or a Unicode identifier.

isISOControl
Link copied to clipboard
expect fun Char.isISOControl(): Boolean

Returns true if this character is an ISO control character.

Since Kotlin

1.5
actual inline fun Char.isISOControl(): Boolean

Returns true if this character is an ISO control character.

actual fun Char.isISOControl(): Boolean

Returns true if this character is an ISO control character.

Since Kotlin

1.5
actual external fun Char.isISOControl(): Boolean

Returns true if this character is an ISO control character.

isJavaIdentifierPart
Link copied to clipboard
inline fun Char.isJavaIdentifierPart(): Boolean

Returns true if this character (Unicode code point) may be part of a Java identifier as other than the first character.

isJavaIdentifierStart
Link copied to clipboard
inline fun Char.isJavaIdentifierStart(): Boolean

Returns true if this character is permissible as the first character in a Java identifier.

isLetter
Link copied to clipboard
expect fun Char.isLetter(): Boolean

Returns true if this character is a letter.

Since Kotlin

1.5
actual inline fun Char.isLetter(): Boolean

Returns true if this character is a letter.

actual fun Char.isLetter(): Boolean

Returns true if this character is a letter.

Since Kotlin

1.5
actual fun Char.isLetter(): Boolean

Returns true if this character is a letter.

isLetterOrDigit
Link copied to clipboard
expect fun Char.isLetterOrDigit(): Boolean

Returns true if this character is a letter or digit.

Since Kotlin

1.5
actual inline fun Char.isLetterOrDigit(): Boolean

Returns true if this character is a letter or digit.

actual fun Char.isLetterOrDigit(): Boolean

Returns true if this character is a letter or digit.

Since Kotlin

1.5
actual fun Char.isLetterOrDigit(): Boolean

Returns true if this character is a letter or digit.

isLowerCase
Link copied to clipboard
expect fun Char.isLowerCase(): Boolean

Returns true if this character is a lower case letter.

Since Kotlin

1.5
actual inline fun Char.isLowerCase(): Boolean

Returns true if this character is lower case.

actual fun Char.isLowerCase(): Boolean

Returns true if this character is a lower case letter.

Since Kotlin

1.5
actual fun Char.isLowerCase(): Boolean

Returns true if this character is a lower case letter.

isLowSurrogate
Link copied to clipboard
expect fun Char.isLowSurrogate(): Boolean
actual inline fun Char.isLowSurrogate(): Boolean

Returns true if this character is a Unicode low-surrogate code unit (also known as trailing-surrogate code unit).

actual fun Char.isLowSurrogate(): Boolean

Returns true if this character is a Unicode low-surrogate code unit (also known as trailing-surrogate code unit).

actual external fun Char.isLowSurrogate(): Boolean

Returns true if this character is a Unicode low-surrogate code unit (also known as trailing-surrogate code unit).

isNotBlank
Link copied to clipboard
inline fun CharSequence.isNotBlank(): Boolean

Returns true if this char sequence is not empty and contains some characters except of whitespace characters.

isNotEmpty
Link copied to clipboard
inline fun CharSequence.isNotEmpty(): Boolean

Returns true if this char sequence is not empty.

isNullOrBlank
Link copied to clipboard
inline fun CharSequence?.isNullOrBlank(): Boolean

Returns true if this nullable char sequence is either null or empty or consists solely of whitespace characters.

isNullOrEmpty
Link copied to clipboard
inline fun CharSequence?.isNullOrEmpty(): Boolean

Returns true if this nullable char sequence is either null or empty.

isSupplementaryCodePoint
Link copied to clipboard
fun Char.Companion.isSupplementaryCodePoint(codepoint: Int): Boolean

Checks if the codepoint specified is a supplementary codepoint or not.

isSurrogate
Link copied to clipboard
fun Char.isSurrogate(): Boolean

Returns true if this character is a Unicode surrogate code unit.

isSurrogatePair
Link copied to clipboard
fun Char.Companion.isSurrogatePair(high: Char, low: Char): Boolean
isTitleCase
Link copied to clipboard
expect fun Char.isTitleCase(): Boolean

Returns true if this character is a title case letter.

Since Kotlin

1.5
actual inline fun Char.isTitleCase(): Boolean

Returns true if this character is a title case letter.

actual fun Char.isTitleCase(): Boolean

Returns true if this character is a title case letter.

Since Kotlin

1.5
actual fun Char.isTitleCase(): Boolean

Returns true if this character is a title case letter.

Since Kotlin

1.5
isUpperCase
Link copied to clipboard
expect fun Char.isUpperCase(): Boolean

Returns true if this character is an upper case letter.

Since Kotlin

1.5
actual inline fun Char.isUpperCase(): Boolean

Returns true if this character is upper case.

actual fun Char.isUpperCase(): Boolean

Returns true if this character is an upper case letter.

Since Kotlin

1.5
actual fun Char.isUpperCase(): Boolean

Returns true if this character is an upper case letter.

isWhitespace
Link copied to clipboard
expect fun Char.isWhitespace(): Boolean

Determines whether a character is whitespace according to the Unicode standard. Returns true if the character is whitespace.

actual fun Char.isWhitespace(): Boolean

Determines whether a character is whitespace according to the Unicode standard. Returns true if the character is whitespace.

actual fun Char.isWhitespace(): Boolean

Determines whether a character is whitespace according to the Unicode standard. Returns true if the character is whitespace.

actual fun Char.isWhitespace(): Boolean

Determines whether a character is whitespace according to the Unicode standard. Returns true if the character is whitespace.

iterator
Link copied to clipboard
operator fun CharSequence.iterator(): CharIterator

Iterator for characters of the given char sequence.

last
Link copied to clipboard
fun CharSequence.last(): Char

Returns the last character.

inline fun CharSequence.last(predicate: (Char) -> Boolean): Char

Returns the last character matching the given predicate.

lastIndexOf
Link copied to clipboard
fun CharSequence.lastIndexOf(char: Char, startIndex: Int = lastIndex, ignoreCase: Boolean = false): Int

Returns the index within this char sequence of the last occurrence of the specified character, starting from the specified startIndex.

fun CharSequence.lastIndexOf(string: String, startIndex: Int = lastIndex, ignoreCase: Boolean = false): Int

Returns the index within this char sequence of the last occurrence of the specified string, starting from the specified startIndex.

lastIndexOfAny
Link copied to clipboard
fun CharSequence.lastIndexOfAny(chars: CharArray, startIndex: Int = lastIndex, ignoreCase: Boolean = false): Int

Finds the index of the last occurrence of any of the specified chars in this char sequence, starting from the specified startIndex and optionally ignoring the case.

fun CharSequence.lastIndexOfAny(strings: Collection<String>, startIndex: Int = lastIndex, ignoreCase: Boolean = false): Int

Finds the index of the last occurrence of any of the specified strings in this char sequence, starting from the specified startIndex and optionally ignoring the case.

lastOrNull
Link copied to clipboard
fun CharSequence.lastOrNull(): Char?

Returns the last character, or null if the char sequence is empty.

inline fun CharSequence.lastOrNull(predicate: (Char) -> Boolean): Char?

Returns the last character matching the given predicate, or null if no such character was found.

lines
Link copied to clipboard
fun CharSequence.lines(): List<String>

Splits this char sequence to a list of lines delimited by any of the following character sequences: CRLF, LF or CR.

lineSequence
Link copied to clipboard
fun CharSequence.lineSequence(): Sequence<String>

Splits this char sequence to a sequence of lines delimited by any of the following character sequences: CRLF, LF or CR.

lowercase
Link copied to clipboard
expect fun Char.lowercase(): String

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

Since Kotlin

1.5
expect fun String.lowercase(): String

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

Since Kotlin

1.5
actual inline fun Char.lowercase(): String

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

Since Kotlin

1.5
actual inline fun String.lowercase(): String

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

Since Kotlin

1.5
fun Char.lowercase(locale: Locale): String

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

Since Kotlin

1.5
inline fun String.lowercase(locale: Locale): String

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

Since Kotlin

1.5
actual inline fun Char.lowercase(): String

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

Since Kotlin

1.5
actual inline fun String.lowercase(): String

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

Since Kotlin

1.5
actual fun Char.lowercase(): String

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

Since Kotlin

1.5
actual fun String.lowercase(): String

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

Since Kotlin

1.5
lowercaseChar
Link copied to clipboard
expect fun Char.lowercaseChar(): Char

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

Since Kotlin

1.5
actual inline fun Char.lowercaseChar(): Char

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

Since Kotlin

1.5
actual inline fun Char.lowercaseChar(): Char

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

Since Kotlin

1.5
actual fun Char.lowercaseChar(): Char

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

Since Kotlin

1.5
map
Link copied to clipboard
inline fun <R> CharSequence.map(transform: (Char) -> R): List<R>

Returns a list containing the results of applying the given transform function to each character in the original char sequence.

mapIndexed
Link copied to clipboard
inline fun <R> CharSequence.mapIndexed(transform: (index: Int, Char) -> R): List<R>

Returns a list containing the results of applying the given transform function to each character and its index in the original char sequence.

mapIndexedNotNull
Link copied to clipboard
inline fun <R : Any> CharSequence.mapIndexedNotNull(transform: (index: Int, Char) -> R?): List<R>

Returns a list containing only the non-null results of applying the given transform function to each character and its index in the original char sequence.

mapIndexedNotNullTo
Link copied to clipboard
inline fun <R : Any, C : MutableCollection<in R>> CharSequence.mapIndexedNotNullTo(destination: C, transform: (index: Int, Char) -> R?): C

Applies the given transform function to each character and its index in the original char sequence and appends only the non-null results to the given destination.

mapIndexedTo
Link copied to clipboard
inline fun <R, C : MutableCollection<in R>> CharSequence.mapIndexedTo(destination: C, transform: (index: Int, Char) -> R): C

Applies the given transform function to each character and its index in the original char sequence and appends the results to the given destination.

mapNotNull
Link copied to clipboard
inline fun <R : Any> CharSequence.mapNotNull(transform: (Char) -> R?): List<R>

Returns a list containing only the non-null results of applying the given transform function to each character in the original char sequence.

mapNotNullTo
Link copied to clipboard
inline fun <R : Any, C : MutableCollection<in R>> CharSequence.mapNotNullTo(destination: C, transform: (Char) -> R?): C

Applies the given transform function to each character in the original char sequence and appends only the non-null results to the given destination.

mapTo
Link copied to clipboard
inline fun <R, C : MutableCollection<in R>> CharSequence.mapTo(destination: C, transform: (Char) -> R): C

Applies the given transform function to each character of the original char sequence and appends the results to the given destination.

match
Link copied to clipboard
inline fun String.match(regex: String): Array<String>?
matches
Link copied to clipboard
infix inline fun CharSequence.matches(regex: Regex): Boolean

Returns true if this char sequence matches the given regular expression.

fun String.matches(regex: String): Boolean
max
Link copied to clipboard
@DeprecatedSinceKotlin(warningSince = "1.4", errorSince = "1.5")
fun CharSequence.max(): Char?
maxBy
Link copied to clipboard
@DeprecatedSinceKotlin(warningSince = "1.4", errorSince = "1.5")
inline fun <R : Comparable<R>> CharSequence.maxBy(selector: (Char) -> R): Char?
maxByOrNull
Link copied to clipboard
inline fun <R : Comparable<R>> CharSequence.maxByOrNull(selector: (Char) -> R): Char?

Returns the first character yielding the largest value of the given function or null if there are no characters.

Since Kotlin

1.4
maxOf
Link copied to clipboard
inline fun <R : Comparable<R>> CharSequence.maxOf(selector: (Char) -> R): R
inline fun CharSequence.maxOf(selector: (Char) -> Double): Double
inline fun CharSequence.maxOf(selector: (Char) -> Float): Float

Returns the largest value among all values produced by selector function applied to each character in the char sequence.

Since Kotlin

1.4
maxOfOrNull
Link copied to clipboard
inline fun <R : Comparable<R>> CharSequence.maxOfOrNull(selector: (Char) -> R): R?
inline fun CharSequence.maxOfOrNull(selector: (Char) -> Double): Double?
inline fun CharSequence.maxOfOrNull(selector: (Char) -> Float): Float?

Returns the largest value among all values produced by selector function applied to each character in the char sequence or null if there are no characters.

Since Kotlin

1.4
maxOfWith
Link copied to clipboard
inline fun <R> CharSequence.maxOfWith(comparator: Comparator<in R>, selector: (Char) -> R): R

Returns the largest value according to the provided comparator among all values produced by selector function applied to each character in the char sequence.

Since Kotlin

1.4
maxOfWithOrNull
Link copied to clipboard
inline fun <R> CharSequence.maxOfWithOrNull(comparator: Comparator<in R>, selector: (Char) -> R): R?

Returns the largest value according to the provided comparator among all values produced by selector function applied to each character in the char sequence or null if there are no characters.

Since Kotlin

1.4
maxOrNull
Link copied to clipboard
fun CharSequence.maxOrNull(): Char?

Returns the largest character or null if there are no characters.

Since Kotlin

1.4
maxWith
Link copied to clipboard
@DeprecatedSinceKotlin(warningSince = "1.4", errorSince = "1.5")
fun CharSequence.maxWith(comparator: Comparator<in Char>): Char?
maxWithOrNull
Link copied to clipboard
fun CharSequence.maxWithOrNull(comparator: Comparator<in Char>): Char?

Returns the first character having the largest value according to the provided comparator or null if there are no characters.

Since Kotlin

1.4
min
Link copied to clipboard
@DeprecatedSinceKotlin(warningSince = "1.4", errorSince = "1.5")
fun CharSequence.min(): Char?
minBy
Link copied to clipboard
@DeprecatedSinceKotlin(warningSince = "1.4", errorSince = "1.5")
inline fun <R : Comparable<R>> CharSequence.minBy(selector: (Char) -> R): Char?
minByOrNull
Link copied to clipboard
inline fun <R : Comparable<R>> CharSequence.minByOrNull(selector: (Char) -> R): Char?

Returns the first character yielding the smallest value of the given function or null if there are no characters.

Since Kotlin

1.4
minOf
Link copied to clipboard
inline fun <R : Comparable<R>> CharSequence.minOf(selector: (Char) -> R): R
inline fun CharSequence.minOf(selector: (Char) -> Double): Double
inline fun CharSequence.minOf(selector: (Char) -> Float): Float

Returns the smallest value among all values produced by selector function applied to each character in the char sequence.

Since Kotlin

1.4
minOfOrNull
Link copied to clipboard
inline fun <R : Comparable<R>> CharSequence.minOfOrNull(selector: (Char) -> R): R?
inline fun CharSequence.minOfOrNull(selector: (Char) -> Double): Double?
inline fun CharSequence.minOfOrNull(selector: (Char) -> Float): Float?

Returns the smallest value among all values produced by selector function applied to each character in the char sequence or null if there are no characters.

Since Kotlin

1.4
minOfWith
Link copied to clipboard
inline fun <R> CharSequence.minOfWith(comparator: Comparator<in R>, selector: (Char) -> R): R

Returns the smallest value according to the provided comparator among all values produced by selector function applied to each character in the char sequence.

Since Kotlin

1.4
minOfWithOrNull
Link copied to clipboard
inline fun <R> CharSequence.minOfWithOrNull(comparator: Comparator<in R>, selector: (Char) -> R): R?

Returns the smallest value according to the provided comparator among all values produced by selector function applied to each character in the char sequence or null if there are no characters.

Since Kotlin

1.4
minOrNull
Link copied to clipboard
fun CharSequence.minOrNull(): Char?

Returns the smallest character or null if there are no characters.

Since Kotlin

1.4
minWith
Link copied to clipboard
@DeprecatedSinceKotlin(warningSince = "1.4", errorSince = "1.5")
fun CharSequence.minWith(comparator: Comparator<in Char>): Char?
minWithOrNull
Link copied to clipboard
fun CharSequence.minWithOrNull(comparator: Comparator<in Char>): Char?

Returns the first character having the smallest value according to the provided comparator or null if there are no characters.

Since Kotlin

1.4
none
Link copied to clipboard
fun CharSequence.none(): Boolean

Returns true if the char sequence has no characters.

inline fun CharSequence.none(predicate: (Char) -> Boolean): Boolean

Returns true if no characters match the given predicate.

offsetByCodePoints
Link copied to clipboard
inline fun String.offsetByCodePoints(index: Int, codePointOffset: Int): Int

Returns the index within this string that is offset from the given index by codePointOffset code points.

onEach
Link copied to clipboard
inline fun <S : CharSequence> S.onEach(action: (Char) -> Unit): S

Performs the given action on each character and returns the char sequence itself afterwards.

Since Kotlin

1.1
onEachIndexed
Link copied to clipboard
inline fun <S : CharSequence> S.onEachIndexed(action: (index: Int, Char) -> Unit): S

Performs the given action on each character, providing sequential index with the character, and returns the char sequence itself afterwards.

Since Kotlin

1.4
orEmpty
Link copied to clipboard
inline fun String?.orEmpty(): String

Returns the string if it is not null, or the empty string otherwise.

padEnd
Link copied to clipboard
fun CharSequence.padEnd(length: Int, padChar: Char = ' '): CharSequence

Returns a char sequence with content of this char sequence padded at the end to the specified length with the specified character or space.

fun String.padEnd(length: Int, padChar: Char = ' '): String

Pads the string to the specified length at the end with the specified character or space.

padStart
Link copied to clipboard
fun CharSequence.padStart(length: Int, padChar: Char = ' '): CharSequence

Returns a char sequence with content of this char sequence padded at the beginning to the specified length with the specified character or space.

fun String.padStart(length: Int, padChar: Char = ' '): String

Pads the string to the specified length at the beginning with the specified character or space.

partition
Link copied to clipboard
inline fun CharSequence.partition(predicate: (Char) -> Boolean): Pair<CharSequence, CharSequence>

Splits the original char sequence into pair of char sequences, where first char sequence contains characters for which predicate yielded true, while second char sequence contains characters for which predicate yielded false.

inline fun String.partition(predicate: (Char) -> Boolean): Pair<String, String>

Splits the original string into pair of strings, where first string contains characters for which predicate yielded true, while second string contains characters for which predicate yielded false.

plus
Link copied to clipboard
inline operator fun Char.plus(other: String): String

Concatenates this Char and a String.

prependIndent
Link copied to clipboard
fun String.prependIndent(indent: String = " "): String

Prepends indent to every line of the original string.

random
Link copied to clipboard
inline fun CharSequence.random(): Char

Returns a random character from this char sequence.

Since Kotlin

1.3
fun CharSequence.random(random: Random): Char

Returns a random character from this char sequence using the specified source of randomness.

Since Kotlin

1.3
randomOrNull
Link copied to clipboard
inline fun CharSequence.randomOrNull(): Char?

Returns a random character from this char sequence, or null if this char sequence is empty.

Since Kotlin

1.4
fun CharSequence.randomOrNull(random: Random): Char?

Returns a random character from this char sequence using the specified source of randomness, or null if this char sequence is empty.

Since Kotlin

1.4
reduce
Link copied to clipboard
inline fun CharSequence.reduce(operation: (acc: Char, Char) -> Char): Char

Accumulates value starting with the first character and applying operation from left to right to current accumulator value and each character.

reduceIndexed
Link copied to clipboard
inline fun CharSequence.reduceIndexed(operation: (index: Int, acc: Char, Char) -> Char): Char

Accumulates value starting with the first character and applying operation from left to right to current accumulator value and each character with its index in the original char sequence.

reduceIndexedOrNull
Link copied to clipboard
inline fun CharSequence.reduceIndexedOrNull(operation: (index: Int, acc: Char, Char) -> Char): Char?

Accumulates value starting with the first character and applying operation from left to right to current accumulator value and each character with its index in the original char sequence.

Since Kotlin

1.4
reduceOrNull
Link copied to clipboard
inline fun CharSequence.reduceOrNull(operation: (acc: Char, Char) -> Char): Char?

Accumulates value starting with the first character and applying operation from left to right to current accumulator value and each character.

Since Kotlin

1.4
reduceRight
Link copied to clipboard
inline fun CharSequence.reduceRight(operation: (Char, acc: Char) -> Char): Char

Accumulates value starting with the last character and applying operation from right to left to each character and current accumulator value.

reduceRightIndexed
Link copied to clipboard
inline fun CharSequence.reduceRightIndexed(operation: (index: Int, Char, acc: Char) -> Char): Char

Accumulates value starting with the last character and applying operation from right to left to each character with its index in the original char sequence and current accumulator value.

reduceRightIndexedOrNull
Link copied to clipboard
inline fun CharSequence.reduceRightIndexedOrNull(operation: (index: Int, Char, acc: Char) -> Char): Char?

Accumulates value starting with the last character and applying operation from right to left to each character with its index in the original char sequence and current accumulator value.

Since Kotlin

1.4
reduceRightOrNull
Link copied to clipboard
inline fun CharSequence.reduceRightOrNull(operation: (Char, acc: Char) -> Char): Char?

Accumulates value starting with the last character and applying operation from right to left to each character and current accumulator value.

Since Kotlin

1.4
Regex_0
Link copied to clipboard
fun Regex_0(pattern: String, option: RegexOption): Regex

Creates a regular expression from the specified pattern string and the specified single option.

Regex_1
Link copied to clipboard
fun Regex_1(pattern: String): Regex

Creates a regular expression from the specified pattern string and the default options.

regionMatches
Link copied to clipboard
expect fun CharSequence.regionMatches(thisOffset: Int, other: CharSequence, otherOffset: Int, length: Int, ignoreCase: Boolean = false): Boolean

Returns true if the specified range in this char sequence is equal to the specified range in another char sequence.

actual fun CharSequence.regionMatches(thisOffset: Int, other: CharSequence, otherOffset: Int, length: Int, ignoreCase: Boolean = false): Boolean

Returns true if the specified range in this char sequence is equal to the specified range in another char sequence.

fun String.regionMatches(thisOffset: Int, other: String, otherOffset: Int, length: Int, ignoreCase: Boolean = false): Boolean

Returns true if the specified range in this string is equal to the specified range in another string.

actual fun CharSequence.regionMatches(thisOffset: Int, other: CharSequence, otherOffset: Int, length: Int, ignoreCase: Boolean = false): Boolean
actual fun CharSequence.regionMatches(thisOffset: Int, other: CharSequence, otherOffset: Int, length: Int, ignoreCase: Boolean = false): Boolean

Returns true if the specified range in this char sequence is equal to the specified range in another char sequence.

fun String.regionMatches(thisOffset: Int, other: String, otherOffset: Int, length: Int, ignoreCase: Boolean = false): Boolean

Returns true if the specified range in this string is equal to the specified range in another string.

removePrefix
Link copied to clipboard
fun CharSequence.removePrefix(prefix: CharSequence): CharSequence

If this char sequence starts with the given prefix, returns a new char sequence with the prefix removed. Otherwise, returns a new char sequence with the same characters.

fun String.removePrefix(prefix: CharSequence): String

If this string starts with the given prefix, returns a copy of this string with the prefix removed. Otherwise, returns this string.

removeRange
Link copied to clipboard
fun CharSequence.removeRange(range: IntRange): CharSequence

Returns a char sequence with content of this char sequence where its part at the given range is removed.

inline fun String.removeRange(range: IntRange): String

Removes the part of a string at the given range.

fun CharSequence.removeRange(startIndex: Int, endIndex: Int): CharSequence

Returns a char sequence with content of this char sequence where its part at the given range is removed.

inline fun String.removeRange(startIndex: Int, endIndex: Int): String

Removes the part of a string at a given range.

removeSuffix
Link copied to clipboard
fun CharSequence.removeSuffix(suffix: CharSequence): CharSequence

If this char sequence ends with the given suffix, returns a new char sequence with the suffix removed. Otherwise, returns a new char sequence with the same characters.

fun String.removeSuffix(suffix: CharSequence): String

If this string ends with the given suffix, returns a copy of this string with the suffix removed. Otherwise, returns this string.

removeSurrounding
Link copied to clipboard
fun CharSequence.removeSurrounding(delimiter: CharSequence): CharSequence

When this char sequence starts with and ends with the given delimiter, returns a new char sequence having this delimiter removed both from the start and end. Otherwise returns a new char sequence with the same characters.

fun String.removeSurrounding(delimiter: CharSequence): String

Removes the given delimiter string from both the start and the end of this string if and only if it starts with and ends with the delimiter. Otherwise returns this string unchanged.

fun CharSequence.removeSurrounding(prefix: CharSequence, suffix: CharSequence): CharSequence

When this char sequence starts with the given prefix and ends with the given suffix, returns a new char sequence having both the given prefix and suffix removed. Otherwise returns a new char sequence with the same characters.

fun String.removeSurrounding(prefix: CharSequence, suffix: CharSequence): String

Removes from a string both the given prefix and suffix if and only if it starts with the prefix and ends with the suffix. Otherwise returns this string unchanged.

repeat
Link copied to clipboard
expect fun CharSequence.repeat(n: Int): String

Returns a string containing this char sequence repeated n times.

actual fun CharSequence.repeat(n: Int): String

Returns a string containing this char sequence repeated n times.

actual fun CharSequence.repeat(n: Int): String

Returns a string containing this char sequence repeated n times.

actual fun CharSequence.repeat(n: Int): String

Returns a string containing this char sequence repeated n times.

replace
Link copied to clipboard
inline fun CharSequence.replace(regex: Regex, noinline transform: (MatchResult) -> CharSequence): String

Returns a new string obtained by replacing each substring of this char sequence that matches the given regular expression with the result of the given function transform that takes MatchResult and returns a string to be used as a replacement for that match.

inline fun CharSequence.replace(regex: Regex, replacement: String): String

Returns a new string obtained by replacing each substring of this char sequence that matches the given regular expression with the given replacement.

expect fun String.replace(oldChar: Char, newChar: Char, ignoreCase: Boolean = false): String

Returns a new string with all occurrences of oldChar replaced with newChar.

expect fun String.replace(oldValue: String, newValue: String, ignoreCase: Boolean = false): String

Returns a new string obtained by replacing all occurrences of the oldValue substring in this string with the specified newValue string.

actual fun String.replace(oldChar: Char, newChar: Char, ignoreCase: Boolean = false): String

Returns a new string with all occurrences of oldChar replaced with newChar.

actual fun String.replace(oldValue: String, newValue: String, ignoreCase: Boolean = false): String

Returns a new string obtained by replacing all occurrences of the oldValue substring in this string with the specified newValue string.

actual fun String.replace(oldChar: Char, newChar: Char, ignoreCase: Boolean = false): String

Returns a new string with all occurrences of oldChar replaced with newChar.

actual fun String.replace(oldValue: String, newValue: String, ignoreCase: Boolean = false): String

Returns a new string obtained by replacing all occurrences of the oldValue substring in this string with the specified newValue string.

actual fun String.replace(oldChar: Char, newChar: Char, ignoreCase: Boolean = false): String

Returns a new string with all occurrences of oldChar replaced with newChar.

actual fun String.replace(oldValue: String, newValue: String, ignoreCase: Boolean = false): String

Returns a new string obtained by replacing all occurrences of the oldValue substring in this string with the specified newValue string.

replaceAfter
Link copied to clipboard
fun String.replaceAfter(delimiter: Char, replacement: String, missingDelimiterValue: String = this): String
fun String.replaceAfter(delimiter: String, replacement: String, missingDelimiterValue: String = this): String

Replace part of string after the first occurrence of given delimiter with the replacement string. If the string does not contain the delimiter, returns missingDelimiterValue which defaults to the original string.

replaceAfterLast
Link copied to clipboard
fun String.replaceAfterLast(delimiter: Char, replacement: String, missingDelimiterValue: String = this): String
fun String.replaceAfterLast(delimiter: String, replacement: String, missingDelimiterValue: String = this): String

Replace part of string after the last occurrence of given delimiter with the replacement string. If the string does not contain the delimiter, returns missingDelimiterValue which defaults to the original string.

replaceBefore
Link copied to clipboard
fun String.replaceBefore(delimiter: Char, replacement: String, missingDelimiterValue: String = this): String
fun String.replaceBefore(delimiter: String, replacement: String, missingDelimiterValue: String = this): String

Replace part of string before the first occurrence of given delimiter with the replacement string. If the string does not contain the delimiter, returns missingDelimiterValue which defaults to the original string.

replaceBeforeLast
Link copied to clipboard
fun String.replaceBeforeLast(delimiter: Char, replacement: String, missingDelimiterValue: String = this): String
fun String.replaceBeforeLast(delimiter: String, replacement: String, missingDelimiterValue: String = this): String

Replace part of string before the last occurrence of given delimiter with the replacement string. If the string does not contain the delimiter, returns missingDelimiterValue which defaults to the original string.

replaceFirst
Link copied to clipboard
inline fun CharSequence.replaceFirst(regex: Regex, replacement: String): String

Replaces the first occurrence of the given regular expression regex in this char sequence with specified replacement expression.

expect fun String.replaceFirst(oldChar: Char, newChar: Char, ignoreCase: Boolean = false): String

Returns a new string with the first occurrence of oldChar replaced with newChar.

expect fun String.replaceFirst(oldValue: String, newValue: String, ignoreCase: Boolean = false): String

Returns a new string obtained by replacing the first occurrence of the oldValue substring in this string with the specified newValue string.

actual fun String.replaceFirst(oldChar: Char, newChar: Char, ignoreCase: Boolean = false): String

Returns a new string with the first occurrence of oldChar replaced with newChar.

actual fun String.replaceFirst(oldValue: String, newValue: String, ignoreCase: Boolean = false): String

Returns a new string obtained by replacing the first occurrence of the oldValue substring in this string with the specified newValue string.

actual fun String.replaceFirst(oldChar: Char, newChar: Char, ignoreCase: Boolean = false): String
actual fun String.replaceFirst(oldValue: String, newValue: String, ignoreCase: Boolean = false): String
actual fun String.replaceFirst(oldChar: Char, newChar: Char, ignoreCase: Boolean = false): String

Returns a new string with the first occurrence of oldChar replaced with newChar.

actual fun String.replaceFirst(oldValue: String, newValue: String, ignoreCase: Boolean = false): String

Returns a new string obtained by replacing the first occurrence of the oldValue substring in this string with the specified newValue string.

replaceFirstChar
Link copied to clipboard
@JvmName(name = "replaceFirstCharWithCharSequence")
inline fun String.replaceFirstChar(transform: (Char) -> CharSequence): String
@JvmName(name = "replaceFirstCharWithChar")
inline fun String.replaceFirstChar(transform: (Char) -> Char): String

Returns a copy of this string having its first character replaced with the result of the specified transform, or the original string if it's empty.

Since Kotlin

1.5
replaceIndent
Link copied to clipboard
fun String.replaceIndent(newIndent: String = ""): String

Detects a common minimal indent like it does trimIndent and replaces it with the specified newIndent.

replaceIndentByMargin
Link copied to clipboard
fun String.replaceIndentByMargin(newIndent: String = "", marginPrefix: String = "|"): String

Detects indent by marginPrefix as it does trimMargin and replace it with newIndent.

replaceRange
Link copied to clipboard
fun CharSequence.replaceRange(range: IntRange, replacement: CharSequence): CharSequence

Returns a char sequence with content of this char sequence where its part at the given range is replaced with the replacement char sequence.

inline fun String.replaceRange(range: IntRange, replacement: CharSequence): String

Replace the part of string at the given range with the replacement string.

fun CharSequence.replaceRange(startIndex: Int, endIndex: Int, replacement: CharSequence): CharSequence

Returns a char sequence with content of this char sequence where its part at the given range is replaced with the replacement char sequence.

inline fun String.replaceRange(startIndex: Int, endIndex: Int, replacement: CharSequence): String

Replaces the part of the string at the given range with the replacement char sequence.

reversed
Link copied to clipboard
fun CharSequence.reversed(): CharSequence

Returns a char sequence with characters in reversed order.

inline fun String.reversed(): String

Returns a string with characters in reversed order.

runningFold
Link copied to clipboard
inline fun <R> CharSequence.runningFold(initial: R, operation: (R, Char) -> R): List<R>

Returns a list containing successive accumulation values generated by applying operation from left to right to each character and current accumulator value that starts with initial value.

Since Kotlin

1.4
runningFoldIndexed
Link copied to clipboard
inline fun <R> CharSequence.runningFoldIndexed(initial: R, operation: (index: Int, R, Char) -> R): List<R>

Returns a list containing successive accumulation values generated by applying operation from left to right to each character, its index in the original char sequence and current accumulator value that starts with initial value.

Since Kotlin

1.4
runningReduce
Link copied to clipboard
inline fun CharSequence.runningReduce(operation: (acc: Char, Char) -> Char): List<Char>

Returns a list containing successive accumulation values generated by applying operation from left to right to each character and current accumulator value that starts with the first character of this char sequence.

Since Kotlin

1.4
runningReduceIndexed
Link copied to clipboard
inline fun CharSequence.runningReduceIndexed(operation: (index: Int, acc: Char, Char) -> Char): List<Char>

Returns a list containing successive accumulation values generated by applying operation from left to right to each character, its index in the original char sequence and current accumulator value that starts with the first character of this char sequence.

Since Kotlin

1.4
scan
Link copied to clipboard
inline fun <R> CharSequence.scan(initial: R, operation: (R, Char) -> R): List<R>

Returns a list containing successive accumulation values generated by applying operation from left to right to each character and current accumulator value that starts with initial value.

Since Kotlin

1.4
scanIndexed
Link copied to clipboard
inline fun <R> CharSequence.scanIndexed(initial: R, operation: (index: Int, R, Char) -> R): List<R>

Returns a list containing successive accumulation values generated by applying operation from left to right to each character, its index in the original char sequence and current accumulator value that starts with initial value.

Since Kotlin

1.4
set
Link copied to clipboard
expect operator fun StringBuilder.set(index: Int, value: Char)

Sets the character at the specified index to the specified value.

Since Kotlin

1.4
actual inline operator fun StringBuilder.set(index: Int, value: Char)

Sets the character at the specified index to the specified value.

Since Kotlin

1.4
actual inline operator fun StringBuilder.set(index: Int, value: Char)

Sets the character at the specified index to the specified value.

setCharAt
Link copied to clipboard
inline fun StringBuilder.setCharAt(index: Int, value: Char)
setLength
Link copied to clipboard
inline fun StringBuilder.setLength(l: Int)
setRange
Link copied to clipboard
expect fun StringBuilder.setRange(startIndex: Int, endIndex: Int, value: String): StringBuilder

Replaces characters in the specified range of this string builder with characters in the specified string value and returns this instance.

Since Kotlin

1.4
actual inline fun StringBuilder.setRange(startIndex: Int, endIndex: Int, value: String): StringBuilder

Replaces characters in the specified range of this string builder with characters in the specified string value and returns this instance.

Since Kotlin

1.4
actual inline fun StringBuilder.setRange(startIndex: Int, endIndex: Int, value: String): StringBuilder

Replaces characters in the specified range of this string builder with characters in the specified string value and returns this instance.

Since Kotlin

1.4
single
Link copied to clipboard
fun CharSequence.single(): Char

Returns the single character, or throws an exception if the char sequence is empty or has more than one character.

inline fun CharSequence.single(predicate: (Char) -> Boolean): Char

Returns the single character matching the given predicate, or throws exception if there is no or more than one matching character.

singleOrNull
Link copied to clipboard
fun CharSequence.singleOrNull(): Char?

Returns single character, or null if the char sequence is empty or has more than one character.

inline fun CharSequence.singleOrNull(predicate: (Char) -> Boolean): Char?

Returns the single character matching the given predicate, or null if character was not found or more than one character was found.

slice
Link copied to clipboard
fun CharSequence.slice(indices: Iterable<Int>): CharSequence

Returns a char sequence containing characters of the original char sequence at specified indices.

fun CharSequence.slice(indices: IntRange): CharSequence

Returns a char sequence containing characters of the original char sequence at the specified range of indices.

inline fun String.slice(indices: Iterable<Int>): String

Returns a string containing characters of the original string at specified indices.

fun String.slice(indices: IntRange): String

Returns a string containing characters of the original string at the specified range of indices.

split
Link copied to clipboard
inline fun CharSequence.split(regex: Regex, limit: Int = 0): List<String>

Splits this char sequence around matches of the given regular expression.

fun CharSequence.split(vararg delimiters: String, ignoreCase: Boolean = false, limit: Int = 0): List<String>
fun CharSequence.split(vararg delimiters: Char, ignoreCase: Boolean = false, limit: Int = 0): List<String>

Splits this char sequence to a list of strings around occurrences of the specified delimiters.

fun CharSequence.split(regex: Pattern, limit: Int = 0): List<String>

Splits this char sequence around matches of the given regular expression.

splitToSequence
Link copied to clipboard
fun CharSequence.splitToSequence(vararg delimiters: String, ignoreCase: Boolean = false, limit: Int = 0): Sequence<String>
fun CharSequence.splitToSequence(vararg delimiters: Char, ignoreCase: Boolean = false, limit: Int = 0): Sequence<String>

Splits this char sequence to a sequence of strings around occurrences of the specified delimiters.

startsWith
Link copied to clipboard
fun CharSequence.startsWith(char: Char, ignoreCase: Boolean = false): Boolean

Returns true if this char sequence starts with the specified character.

fun CharSequence.startsWith(prefix: CharSequence, ignoreCase: Boolean = false): Boolean

Returns true if this char sequence starts with the specified prefix.

expect fun String.startsWith(prefix: String, ignoreCase: Boolean = false): Boolean
expect fun String.startsWith(prefix: String, startIndex: Int, ignoreCase: Boolean = false): Boolean
fun CharSequence.startsWith(prefix: CharSequence, startIndex: Int, ignoreCase: Boolean = false): Boolean

Returns true if a substring of this char sequence starting at the specified offset startIndex starts with the specified prefix.

actual fun String.startsWith(prefix: String, ignoreCase: Boolean = false): Boolean

Returns true if this string starts with the specified prefix.

actual fun String.startsWith(prefix: String, startIndex: Int, ignoreCase: Boolean = false): Boolean

Returns true if a substring of this string starting at the specified offset startIndex starts with the specified prefix.

actual fun String.startsWith(prefix: String, ignoreCase: Boolean = false): Boolean

Returns true if this string starts with the specified prefix.

actual fun String.startsWith(prefix: String, startIndex: Int, ignoreCase: Boolean = false): Boolean

Returns true if a substring of this string starting at the specified offset startIndex starts with the specified prefix.

actual fun String.startsWith(prefix: String, ignoreCase: Boolean = false): Boolean

Returns true if this string starts with the specified prefix.

actual fun String.startsWith(prefix: String, startIndex: Int, ignoreCase: Boolean = false): Boolean

Returns true if a substring of this string starting at the specified offset startIndex starts with the specified prefix.

String
Link copied to clipboard
@DeprecatedSinceKotlin(warningSince = "1.4", errorSince = "1.5")
expect fun String(chars: CharArray): String

Converts the characters in the specified array to a string.

Since Kotlin

1.2
@DeprecatedSinceKotlin(warningSince = "1.4", errorSince = "1.5")
expect fun String(chars: CharArray, offset: Int, length: Int): String

Converts the characters from a portion of the specified array to a string.

Since Kotlin

1.2
inline fun String(stringBuffer: StringBuffer): String

Converts the contents of the specified StringBuffer to a string.

inline fun String(stringBuilder: StringBuilder): String

Converts the contents of the specified StringBuilder to a string.

inline fun String(bytes: ByteArray): String

Converts the data from the specified array of bytes to characters using the UTF-8 character set and returns the conversion result as a string.

actual inline fun String(chars: CharArray): String

Converts the characters in the specified array to a string.

inline fun String(bytes: ByteArray, charset: Charset): String

Converts the data from the specified array of bytes to characters using the specified character set and returns the conversion result as a string.

inline fun String(bytes: ByteArray, offset: Int, length: Int): String

Converts the data from a portion of the specified array of bytes to characters using the UTF-8 character set and returns the conversion result as a string.

actual inline fun String(chars: CharArray, offset: Int, length: Int): String

Converts the characters from a portion of the specified array to a string.

inline fun String(codePoints: IntArray, offset: Int, length: Int): String

Converts the code points from a portion of the specified Unicode code point array to a string.

inline fun String(bytes: ByteArray, offset: Int, length: Int, charset: Charset): String

Converts the data from a portion of the specified array of bytes to characters using the specified character set and returns the conversion result as a string.

@DeprecatedSinceKotlin(warningSince = "1.4", errorSince = "1.5")
actual fun String(chars: CharArray): String

Converts the characters in the specified array to a string.

Since Kotlin

1.2
@DeprecatedSinceKotlin(warningSince = "1.4", errorSince = "1.5")
actual fun String(chars: CharArray, offset: Int, length: Int): String

Converts the characters from a portion of the specified array to a string.

Since Kotlin

1.2
@DeprecatedSinceKotlin(warningSince = "1.4", errorSince = "1.5")
actual fun String(chars: CharArray): String

Converts the characters in the specified array to a string.

@DeprecatedSinceKotlin(warningSince = "1.4", errorSince = "1.5")
actual fun String(chars: CharArray, offset: Int, length: Int): String

Converts the characters from a portion of the specified array to a string.

subSequence
Link copied to clipboard
fun CharSequence.subSequence(range: IntRange): CharSequence

Returns a subsequence of this char sequence specified by the given range of indices.

inline fun String.subSequence(start: Int, end: Int): CharSequence

Returns a subsequence of this char sequence.

substring
Link copied to clipboard
fun CharSequence.substring(range: IntRange): String

Returns a substring of chars at indices from the specified range of this char sequence.

expect fun String.substring(startIndex: Int): String
expect fun String.substring(startIndex: Int, endIndex: Int): String
fun String.substring(range: IntRange): String

Returns a substring specified by the given range of indices.

inline fun CharSequence.substring(startIndex: Int, endIndex: Int = length): String

Returns a substring of chars from a range of this char sequence starting at the startIndex and ending right before the endIndex.

actual inline fun String.substring(startIndex: Int): String

Returns a substring of this string that starts at the specified startIndex and continues to the end of the string.

actual inline fun String.substring(startIndex: Int, endIndex: Int): String

Returns the substring of this string starting at the startIndex and ending right before the endIndex.

actual inline fun String.substring(startIndex: Int): String
actual inline fun String.substring(startIndex: Int, endIndex: Int): String
actual inline fun String.substring(startIndex: Int): String

Returns a substring of this string that starts at the specified startIndex and continues to the end of the string.

actual inline fun String.substring(startIndex: Int, endIndex: Int): String

Returns the substring of this string starting at the startIndex and ending right before the endIndex.

substringAfter
Link copied to clipboard
fun String.substringAfter(delimiter: Char, missingDelimiterValue: String = this): String
fun String.substringAfter(delimiter: String, missingDelimiterValue: String = this): String

Returns a substring after the first occurrence of delimiter. If the string does not contain the delimiter, returns missingDelimiterValue which defaults to the original string.

substringAfterLast
Link copied to clipboard
fun String.substringAfterLast(delimiter: Char, missingDelimiterValue: String = this): String
fun String.substringAfterLast(delimiter: String, missingDelimiterValue: String = this): String

Returns a substring after the last occurrence of delimiter. If the string does not contain the delimiter, returns missingDelimiterValue which defaults to the original string.

substringBefore
Link copied to clipboard
fun String.substringBefore(delimiter: Char, missingDelimiterValue: String = this): String
fun String.substringBefore(delimiter: String, missingDelimiterValue: String = this): String

Returns a substring before the first occurrence of delimiter. If the string does not contain the delimiter, returns missingDelimiterValue which defaults to the original string.

substringBeforeLast
Link copied to clipboard
fun String.substringBeforeLast(delimiter: Char, missingDelimiterValue: String = this): String
fun String.substringBeforeLast(delimiter: String, missingDelimiterValue: String = this): String

Returns a substring before the last occurrence of delimiter. If the string does not contain the delimiter, returns missingDelimiterValue which defaults to the original string.

sumBy
Link copied to clipboard
@DeprecatedSinceKotlin(warningSince = "1.5")
inline fun CharSequence.sumBy(selector: (Char) -> Int): Int

Returns the sum of all values produced by selector function applied to each character in the char sequence.

sumByDouble
Link copied to clipboard
@DeprecatedSinceKotlin(warningSince = "1.5")
inline fun CharSequence.sumByDouble(selector: (Char) -> Double): Double

Returns the sum of all values produced by selector function applied to each character in the char sequence.

sumOf
Link copied to clipboard
@JvmName(name = "sumOfDouble")
inline fun CharSequence.sumOf(selector: (Char) -> Double): Double
@JvmName(name = "sumOfInt")
inline fun CharSequence.sumOf(selector: (Char) -> Int): Int
@JvmName(name = "sumOfLong")
inline fun CharSequence.sumOf(selector: (Char) -> Long): Long

Returns the sum of all values produced by selector function applied to each character in the char sequence.

Since Kotlin

1.4
@JvmName(name = "sumOfUInt")
inline fun CharSequence.sumOf(selector: (Char) -> UInt): UInt
@JvmName(name = "sumOfULong")
inline fun CharSequence.sumOf(selector: (Char) -> ULong): ULong

Returns the sum of all values produced by selector function applied to each character in the char sequence.

Since Kotlin

1.5
@JvmName(name = "sumOfBigDecimal")
inline fun CharSequence.sumOf(selector: (Char) -> BigDecimal): BigDecimal
@JvmName(name = "sumOfBigInteger")
inline fun CharSequence.sumOf(selector: (Char) -> BigInteger): BigInteger

Returns the sum of all values produced by selector function applied to each character in the char sequence.

Since Kotlin

1.4
take
Link copied to clipboard
fun CharSequence.take(n: Int): CharSequence

Returns a subsequence of this char sequence containing the first n characters from this char sequence, or the entire char sequence if this char sequence is shorter.

fun String.take(n: Int): String

Returns a string containing the first n characters from this string, or the entire string if this string is shorter.

takeLast
Link copied to clipboard
fun CharSequence.takeLast(n: Int): CharSequence

Returns a subsequence of this char sequence containing the last n characters from this char sequence, or the entire char sequence if this char sequence is shorter.

fun String.takeLast(n: Int): String

Returns a string containing the last n characters from this string, or the entire string if this string is shorter.

takeLastWhile
Link copied to clipboard
inline fun CharSequence.takeLastWhile(predicate: (Char) -> Boolean): CharSequence

Returns a subsequence of this char sequence containing last characters that satisfy the given predicate.

inline fun String.takeLastWhile(predicate: (Char) -> Boolean): String

Returns a string containing last characters that satisfy the given predicate.

takeWhile
Link copied to clipboard
inline fun CharSequence.takeWhile(predicate: (Char) -> Boolean): CharSequence

Returns a subsequence of this char sequence containing the first characters that satisfy the given predicate.

inline fun String.takeWhile(predicate: (Char) -> Boolean): String

Returns a string containing the first characters that satisfy the given predicate.

titlecase
Link copied to clipboard
fun Char.titlecase(): String

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

Since Kotlin

1.5
fun Char.titlecase(locale: Locale): String

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

Since Kotlin

1.5
titlecaseChar
Link copied to clipboard
expect fun Char.titlecaseChar(): Char

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

Since Kotlin

1.5
actual inline fun Char.titlecaseChar(): Char

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

Since Kotlin

1.5
actual fun Char.titlecaseChar(): Char

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

Since Kotlin

1.5
actual fun Char.titlecaseChar(): Char

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

Since Kotlin

1.5
toBigDecimal
Link copied to clipboard
inline fun String.toBigDecimal(): BigDecimal
inline fun String.toBigDecimal(mathContext: MathContext): BigDecimal

Parses the string as a java.math.BigDecimal number and returns the result.

Since Kotlin

1.2
toBigDecimalOrNull
Link copied to clipboard
fun String.toBigDecimalOrNull(): BigDecimal?
fun String.toBigDecimalOrNull(mathContext: MathContext): BigDecimal?

Parses the string as a java.math.BigDecimal number and returns the result or null if the string is not a valid representation of a number.

Since Kotlin

1.2
toBigInteger
Link copied to clipboard
inline fun String.toBigInteger(): BigInteger
inline fun String.toBigInteger(radix: Int): BigInteger

Parses the string as a java.math.BigInteger number and returns the result.

Since Kotlin

1.2
toBigIntegerOrNull
Link copied to clipboard
fun String.toBigIntegerOrNull(): BigInteger?
fun String.toBigIntegerOrNull(radix: Int): BigInteger?

Parses the string as a java.math.BigInteger number and returns the result or null if the string is not a valid representation of a number.

Since Kotlin

1.2
toBoolean
Link copied to clipboard
@DeprecatedSinceKotlin(hiddenSince = "1.4")
expect fun String.toBoolean(): Boolean

Returns true if the content of this string is equal to the word "true", ignoring case, and false otherwise.

expect fun String?.toBoolean(): Boolean

Returns true if this string is not null and its content is equal to the word "true", ignoring case, and false otherwise.

Since Kotlin

1.4
@DeprecatedSinceKotlin(hiddenSince = "1.4")
actual inline fun String.toBoolean(): Boolean

Returns true if the content of this string is equal to the word "true", ignoring case, and false otherwise.

@JvmName(name = "toBooleanNullable")
actual inline fun String?.toBoolean(): Boolean

Returns true if this string is not null and its content is equal to the word "true", ignoring case, and false otherwise.

Since Kotlin

1.4
@DeprecatedSinceKotlin(hiddenSince = "1.4")
actual inline fun String.toBoolean(): Boolean

Returns true if the content of this string is equal to the word "true", ignoring case, and false otherwise.

actual fun String?.toBoolean(): Boolean

Returns true if this string is not null and its content is equal to the word "true", ignoring case, and false otherwise.

Since Kotlin

1.4
@DeprecatedSinceKotlin(hiddenSince = "1.4")
actual inline fun String.toBoolean(): Boolean

Returns true if the content of this string is equal to the word "true", ignoring case, and false otherwise.

actual inline fun String?.toBoolean(): Boolean

Returns true if this string is not null and its content is equal to the word "true", ignoring case, and false otherwise.

Since Kotlin

1.4
toBooleanStrict
Link copied to clipboard
fun String.toBooleanStrict(): Boolean

Returns true if the content of this string is equal to the word "true", false if it is equal to "false", and throws an exception otherwise.

Since Kotlin

1.5
toBooleanStrictOrNull
Link copied to clipboard
fun String.toBooleanStrictOrNull(): Boolean?

Returns true if the content of this string is equal to the word "true", false if it is equal to "false", and null otherwise.

Since Kotlin

1.5
toByte
Link copied to clipboard
expect fun String.toByte(): Byte
expect fun String.toByte(radix: Int): Byte

Parses the string as a signed Byte number and returns the result.

actual inline fun String.toByte(): Byte

Parses the string as a signed Byte number and returns the result.

actual inline fun String.toByte(radix: Int): Byte

Parses the string as a signed Byte number and returns the result.

Since Kotlin

1.1
actual fun String.toByte(): Byte
actual fun String.toByte(radix: Int): Byte

Parses the string as a signed Byte number and returns the result.

actual inline fun String.toByte(): Byte

Parses the string as a signed Byte number and returns the result.

actual inline fun String.toByte(radix: Int): Byte

Parses the string as a signed Byte number and returns the result.

Since Kotlin

1.1
toByteArray
Link copied to clipboard
inline fun String.toByteArray(charset: Charset = Charsets.UTF_8): ByteArray

Encodes the contents of this string using the specified character set and returns the resulting byte array.

toByteOrNull
Link copied to clipboard
fun String.toByteOrNull(): Byte?
fun String.toByteOrNull(radix: Int): Byte?

Parses the string as a signed Byte number and returns the result or null if the string is not a valid representation of a number.

Since Kotlin

1.1
toCharArray
Link copied to clipboard
expect fun String.toCharArray(): CharArray

Returns a CharArray containing characters of this string.

Since Kotlin

1.4
expect fun String.toCharArray(startIndex: Int = 0, endIndex: Int = this.length): CharArray

Returns a CharArray containing characters of this string or its substring.

Since Kotlin

1.4
expect fun StringBuilder.toCharArray(destination: CharArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = this.length)

Copies characters from this string builder into the destination character array.

Since Kotlin

1.4
actual inline fun String.toCharArray(): CharArray

Returns a CharArray containing characters of this string.

actual fun String.toCharArray(startIndex: Int = 0, endIndex: Int = this.length): CharArray

Returns a CharArray containing characters of this string or its substring.

Since Kotlin

1.4
inline fun String.toCharArray(destination: CharArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = length): CharArray

Copies characters from this string into the destination character array and returns that array.

actual fun String.toCharArray(): CharArray

Returns a CharArray containing characters of this string.

Since Kotlin

1.4
actual fun String.toCharArray(startIndex: Int = 0, endIndex: Int = this.length): CharArray

Returns a CharArray containing characters of this string or its substring.

Since Kotlin

1.4
actual inline fun StringBuilder.toCharArray(destination: CharArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = this.length)

Copies characters from this string builder into the destination character array.

Since Kotlin

1.4
actual fun String.toCharArray(): CharArray

Returns a CharArray containing characters of this string.

actual fun String.toCharArray(startIndex: Int = 0, endIndex: Int = this.length): CharArray

Returns a CharArray containing characters of this string or its substring.

Since Kotlin

1.3
actual inline fun StringBuilder.toCharArray(destination: CharArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = this.length)

Copies characters from this string builder into the destination character array.

Since Kotlin

1.4
toChars
Link copied to clipboard
fun Char.Companion.toChars(codePoint: Int): CharArray

Converts the codepoint specified to a char array. If the codepoint is not supplementary, the method will return an array with one element otherwise it will return an array A with a high surrogate in A0 and a low surrogate in A1.

toCodePoint
Link copied to clipboard
fun Char.Companion.toCodePoint(high: Char, low: Char): Int

Converts a surrogate pair to a unicode code point. Doesn't validate that the characters are a valid surrogate pair.

toCollection
Link copied to clipboard
fun <C : MutableCollection<in Char>> CharSequence.toCollection(destination: C): C

Appends all characters to the given destination collection.

toDouble
Link copied to clipboard
expect fun String.toDouble(): Double

Parses the string as a Double number and returns the result.

actual inline fun String.toDouble(): Double

Parses the string as a Double number and returns the result.

actual fun String.toDouble(): Double

Parses the string as a Double number and returns the result.

actual inline fun String.toDouble(): Double

Parses the string as a Double number and returns the result.

toDoubleOrNull
Link copied to clipboard
expect fun String.toDoubleOrNull(): Double?

Parses the string as a Double number and returns the result or null if the string is not a valid representation of a number.

actual fun String.toDoubleOrNull(): Double?

Parses the string as a Double number and returns the result or null if the string is not a valid representation of a number.

Since Kotlin

1.1
actual fun String.toDoubleOrNull(): Double?

Parses the string as a Double number and returns the result or null if the string is not a valid representation of a number.

actual fun String.toDoubleOrNull(): Double?

Parses the string as a Double number and returns the result or null if the string is not a valid representation of a number.

Since Kotlin

1.1
toFloat
Link copied to clipboard
expect fun String.toFloat(): Float

Parses the string as a Float number and returns the result.

actual inline fun String.toFloat(): Float

Parses the string as a Float number and returns the result.

actual inline fun String.toFloat(): Float

Parses the string as a Float number and returns the result.

actual inline fun String.toFloat(): Float

Parses the string as a Float number and returns the result.

toFloatOrNull
Link copied to clipboard
expect fun String.toFloatOrNull(): Float?

Parses the string as a Float number and returns the result or null if the string is not a valid representation of a number.

actual fun String.toFloatOrNull(): Float?

Parses the string as a Float number and returns the result or null if the string is not a valid representation of a number.

Since Kotlin

1.1
actual inline fun String.toFloatOrNull(): Float?

Parses the string as a Float number and returns the result or null if the string is not a valid representation of a number.

actual fun String.toFloatOrNull(): Float?

Parses the string as a Float number and returns the result or null if the string is not a valid representation of a number.

Since Kotlin

1.1
toHashSet
Link copied to clipboard
fun CharSequence.toHashSet(): HashSet<Char>

Returns a new HashSet of all characters.

toInt
Link copied to clipboard
expect fun String.toInt(): Int
expect fun String.toInt(radix: Int): Int

Parses the string as an Int number and returns the result.

actual inline fun String.toInt(): Int

Parses the string as an Int number and returns the result.

actual inline fun String.toInt(radix: Int): Int

Parses the string as an Int number and returns the result.

Since Kotlin

1.1
actual fun String.toInt(): Int
actual fun String.toInt(radix: Int): Int

Parses the string as an Int number and returns the result.

actual inline fun String.toInt(): Int

Parses the string as an Int number and returns the result.

actual inline fun String.toInt(radix: Int): Int

Parses the string as an Int number and returns the result.

Since Kotlin

1.1
toIntOrNull
Link copied to clipboard
fun String.toIntOrNull(): Int?
fun String.toIntOrNull(radix: Int): Int?

Parses the string as an Int number and returns the result or null if the string is not a valid representation of a number.

Since Kotlin

1.1
toList
Link copied to clipboard
fun CharSequence.toList(): List<Char>

Returns a List containing all characters.

toLong
Link copied to clipboard
expect fun String.toLong(): Long
expect fun String.toLong(radix: Int): Long

Parses the string as a Long number and returns the result.

actual inline fun String.toLong(): Long

Parses the string as a Long number and returns the result.

actual inline fun String.toLong(radix: Int): Long

Parses the string as a Long number and returns the result.

Since Kotlin

1.1
actual fun String.toLong(): Long
actual fun String.toLong(radix: Int): Long

Parses the string as a Long number and returns the result.

actual inline fun String.toLong(): Long

Parses the string as a Long number and returns the result.

actual inline fun String.toLong(radix: Int): Long

Parses the string as a Long number and returns the result.

Since Kotlin

1.1
toLongOrNull
Link copied to clipboard
fun String.toLongOrNull(): Long?
fun String.toLongOrNull(radix: Int): Long?

Parses the string as a Long number and returns the result or null if the string is not a valid representation of a number.

Since Kotlin

1.1
toLowerCase
Link copied to clipboard
@DeprecatedSinceKotlin(warningSince = "1.5")
expect fun Char.toLowerCase(): Char

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

@DeprecatedSinceKotlin(warningSince = "1.5")
expect fun String.toLowerCase(): String

Returns a copy of this string converted to lower case using the rules of the default locale.

@DeprecatedSinceKotlin(warningSince = "1.5")
actual inline fun Char.toLowerCase(): Char

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

@DeprecatedSinceKotlin(warningSince = "1.5")
actual inline fun String.toLowerCase(): String

Returns a copy of this string converted to lower case using the rules of the default locale.

@DeprecatedSinceKotlin(warningSince = "1.5")
inline fun String.toLowerCase(locale: Locale): String

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

@DeprecatedSinceKotlin(warningSince = "1.5")
actual inline fun Char.toLowerCase(): Char

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

@DeprecatedSinceKotlin(warningSince = "1.5")
actual inline fun String.toLowerCase(): String

Returns a copy of this string converted to lower case using the rules of the default locale.

@DeprecatedSinceKotlin(warningSince = "1.5")
actual fun Char.toLowerCase(): Char

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

@DeprecatedSinceKotlin(warningSince = "1.5")
actual fun String.toLowerCase(): String

Returns a copy of this string converted to lower case using the rules of the default locale.

toMutableList
Link copied to clipboard
fun CharSequence.toMutableList(): MutableList<Char>

Returns a new MutableList filled with all characters of this char sequence.

toPattern
Link copied to clipboard
inline fun String.toPattern(flags: Int = 0): Pattern

Converts the string into a regular expression Pattern optionally with the specified flags from Pattern or'd together so that strings can be split or matched on.

toRegex
Link copied to clipboard
inline fun String.toRegex(): Regex

Converts the string into a regular expression Regex with the default options.

inline fun String.toRegex(options: Set<RegexOption>): Regex

Converts the string into a regular expression Regex with the specified set of options.

inline fun String.toRegex(option: RegexOption): Regex

Converts the string into a regular expression Regex with the specified single option.

inline fun Pattern.toRegex(): Regex

Converts this java.util.regex.Pattern to an instance of Regex.

toSet
Link copied to clipboard
fun CharSequence.toSet(): Set<Char>

Returns a Set of all characters.

toShort
Link copied to clipboard
expect fun String.toShort(): Short
expect fun String.toShort(radix: Int): Short

Parses the string as a Short number and returns the result.

actual inline fun String.toShort(): Short

Parses the string as a Short number and returns the result.

actual inline fun String.toShort(radix: Int): Short

Parses the string as a Short number and returns the result.

Since Kotlin

1.1
actual fun String.toShort(): Short
actual fun String.toShort(radix: Int): Short

Parses the string as a Short number and returns the result.

actual inline fun String.toShort(): Short

Parses the string as a Short number and returns the result.

actual inline fun String.toShort(radix: Int): Short

Parses the string as a Short number and returns the result.

Since Kotlin

1.1
toShortOrNull
Link copied to clipboard
fun String.toShortOrNull(): Short?
fun String.toShortOrNull(radix: Int): Short?

Parses the string as a Short number and returns the result or null if the string is not a valid representation of a number.

Since Kotlin

1.1
toSortedSet
Link copied to clipboard
fun CharSequence.toSortedSet(): SortedSet<Char>

Returns a new SortedSet of all characters.

toString
Link copied to clipboard
expect fun Byte.toString(radix: Int): String

Returns a string representation of this Byte value in the specified radix.

Since Kotlin

1.2
expect fun Int.toString(radix: Int): String

Returns a string representation of this Int value in the specified radix.

Since Kotlin

1.2
expect fun Long.toString(radix: Int): String

Returns a string representation of this Long value in the specified radix.

Since Kotlin

1.2
expect fun Short.toString(radix: Int): String

Returns a string representation of this Short value in the specified radix.

Since Kotlin

1.2
fun UByte.toString(radix: Int): String

Returns a string representation of this Byte value in the specified radix.

Since Kotlin

1.5
fun UInt.toString(radix: Int): String

Returns a string representation of this Int value in the specified radix.

Since Kotlin

1.5
fun ULong.toString(radix: Int): String

Returns a string representation of this Long value in the specified radix.

Since Kotlin

1.5
fun UShort.toString(radix: Int): String

Returns a string representation of this Short value in the specified radix.

Since Kotlin

1.5
actual inline fun Byte.toString(radix: Int): String

Returns a string representation of this Byte value in the specified radix.

Since Kotlin

1.1
actual inline fun Int.toString(radix: Int): String

Returns a string representation of this Int value in the specified radix.

Since Kotlin

1.1
actual inline fun Long.toString(radix: Int): String

Returns a string representation of this Long value in the specified radix.

Since Kotlin

1.1
actual inline fun Short.toString(radix: Int): String

Returns a string representation of this Short value in the specified radix.

Since Kotlin

1.1
actual inline fun Byte.toString(radix: Int): String

Returns a string representation of this Byte value in the specified radix.

Since Kotlin

1.2
actual fun Int.toString(radix: Int): String

Returns a string representation of this Int value in the specified radix.

Since Kotlin

1.2
actual fun Long.toString(radix: Int): String

Returns a string representation of this Long value in the specified radix.

Since Kotlin

1.2
actual inline fun Short.toString(radix: Int): String

Returns a string representation of this Short value in the specified radix.

Since Kotlin

1.2
actual inline fun Byte.toString(radix: Int): String

Returns a string representation of this Byte value in the specified radix.

Since Kotlin

1.1
actual inline fun Int.toString(radix: Int): String

Returns a string representation of this Int value in the specified radix.

Since Kotlin

1.1
actual inline fun Long.toString(radix: Int): String

Returns a string representation of this Long value in the specified radix.

Since Kotlin

1.1
actual inline fun Short.toString(radix: Int): String

Returns a string representation of this Short value in the specified radix.

Since Kotlin

1.1
toTitleCase
Link copied to clipboard
@DeprecatedSinceKotlin(warningSince = "1.5")
inline fun Char.toTitleCase(): Char

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

toUByte
Link copied to clipboard
fun String.toUByte(): UByte
fun String.toUByte(radix: Int): UByte

Parses the string as a signed UByte number and returns the result.

Since Kotlin

1.5
toUByteOrNull
Link copied to clipboard
fun String.toUByteOrNull(): UByte?
fun String.toUByteOrNull(radix: Int): UByte?

Parses the string as an UByte number and returns the result or null if the string is not a valid representation of a number.

Since Kotlin

1.5
toUInt
Link copied to clipboard
fun String.toUInt(): UInt
fun String.toUInt(radix: Int): UInt

Parses the string as an UInt number and returns the result.

Since Kotlin

1.5
toUIntOrNull
Link copied to clipboard
fun String.toUIntOrNull(): UInt?
fun String.toUIntOrNull(radix: Int): UInt?

Parses the string as an UInt number and returns the result or null if the string is not a valid representation of a number.

Since Kotlin

1.5
toULong
Link copied to clipboard
fun String.toULong(): ULong
fun String.toULong(radix: Int): ULong

Parses the string as a ULong number and returns the result.

Since Kotlin

1.5
toULongOrNull
Link copied to clipboard
fun String.toULongOrNull(): ULong?
fun String.toULongOrNull(radix: Int): ULong?

Parses the string as an ULong number and returns the result or null if the string is not a valid representation of a number.

Since Kotlin

1.5
toUpperCase
Link copied to clipboard
@DeprecatedSinceKotlin(warningSince = "1.5")
expect fun Char.toUpperCase(): Char

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

@DeprecatedSinceKotlin(warningSince = "1.5")
expect fun String.toUpperCase(): String

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

@DeprecatedSinceKotlin(warningSince = "1.5")
actual inline fun Char.toUpperCase(): Char

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

@DeprecatedSinceKotlin(warningSince = "1.5")
actual inline fun String.toUpperCase(): String

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

@DeprecatedSinceKotlin(warningSince = "1.5")
inline fun String.toUpperCase(locale: Locale): String

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

@DeprecatedSinceKotlin(warningSince = "1.5")
actual inline fun Char.toUpperCase(): Char

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

@DeprecatedSinceKotlin(warningSince = "1.5")
actual inline fun String.toUpperCase(): String

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

@DeprecatedSinceKotlin(warningSince = "1.5")
actual fun Char.toUpperCase(): Char

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

@DeprecatedSinceKotlin(warningSince = "1.5")
actual fun String.toUpperCase(): String

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

toUShort
Link copied to clipboard
fun String.toUShort(): UShort
fun String.toUShort(radix: Int): UShort

Parses the string as a UShort number and returns the result.

Since Kotlin

1.5
toUShortOrNull
Link copied to clipboard
fun String.toUShortOrNull(): UShort?
fun String.toUShortOrNull(radix: Int): UShort?

Parses the string as an UShort number and returns the result or null if the string is not a valid representation of a number.

Since Kotlin

1.5
trim
Link copied to clipboard
fun CharSequence.trim(): CharSequence

Returns a sub sequence of this char sequence having leading and trailing whitespace removed.

inline fun String.trim(): String

Returns a string having leading and trailing whitespace removed.

fun CharSequence.trim(vararg chars: Char): CharSequence

Returns a sub sequence of this char sequence having leading and trailing characters from the chars array removed.

inline fun CharSequence.trim(predicate: (Char) -> Boolean): CharSequence

Returns a sub sequence of this char sequence having leading and trailing characters matching the predicate removed.

fun String.trim(vararg chars: Char): String

Returns a string having leading and trailing characters from the chars array removed.

inline fun String.trim(predicate: (Char) -> Boolean): String

Returns a string having leading and trailing characters matching the predicate removed.

trimEnd
Link copied to clipboard
fun CharSequence.trimEnd(): CharSequence

Returns a sub sequence of this char sequence having trailing whitespace removed.

inline fun String.trimEnd(): String

Returns a string having trailing whitespace removed.

fun CharSequence.trimEnd(vararg chars: Char): CharSequence

Returns a sub sequence of this char sequence having trailing characters from the chars array removed.

inline fun CharSequence.trimEnd(predicate: (Char) -> Boolean): CharSequence

Returns a sub sequence of this char sequence having trailing characters matching the predicate removed.

fun String.trimEnd(vararg chars: Char): String

Returns a string having trailing characters from the chars array removed.

inline fun String.trimEnd(predicate: (Char) -> Boolean): String

Returns a string having trailing characters matching the predicate removed.

trimIndent
Link copied to clipboard
fun String.trimIndent(): String

Detects a common minimal indent of all the input lines, removes it from every line and also removes the first and the last lines if they are blank (notice difference blank vs empty).

trimMargin
Link copied to clipboard
fun String.trimMargin(marginPrefix: String = "|"): String

Trims leading whitespace characters followed by marginPrefix from every line of a source string and removes the first and the last lines if they are blank (notice difference blank vs empty).

trimStart
Link copied to clipboard
fun CharSequence.trimStart(): CharSequence

Returns a sub sequence of this char sequence having leading whitespace removed.

inline fun String.trimStart(): String

Returns a string having leading whitespace removed.

fun CharSequence.trimStart(vararg chars: Char): CharSequence

Returns a sub sequence of this char sequence having leading characters from the chars array removed.

inline fun CharSequence.trimStart(predicate: (Char) -> Boolean): CharSequence

Returns a sub sequence of this char sequence having leading characters matching the predicate removed.

fun String.trimStart(vararg chars: Char): String

Returns a string having leading characters from the chars array removed.

inline fun String.trimStart(predicate: (Char) -> Boolean): String

Returns a string having leading characters matching the predicate removed.

uppercase
Link copied to clipboard
expect fun Char.uppercase(): String

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

Since Kotlin

1.5
expect fun String.uppercase(): String

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

Since Kotlin

1.5
actual inline fun Char.uppercase(): String

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

Since Kotlin

1.5
actual inline fun String.uppercase(): String

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

Since Kotlin

1.5
fun Char.uppercase(locale: Locale): String

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

Since Kotlin

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

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

Since Kotlin

1.5
actual inline fun Char.uppercase(): String

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

Since Kotlin

1.5
actual inline fun String.uppercase(): String

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

Since Kotlin

1.5
actual fun Char.uppercase(): String

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

Since Kotlin

1.5
actual fun String.uppercase(): String

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

Since Kotlin

1.5
uppercaseChar
Link copied to clipboard
expect fun Char.uppercaseChar(): Char

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

Since Kotlin

1.5
actual inline fun Char.uppercaseChar(): Char

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

Since Kotlin

1.5
actual fun Char.uppercaseChar(): Char

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

Since Kotlin

1.5
actual fun Char.uppercaseChar(): Char

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

Since Kotlin

1.5
windowed
Link copied to clipboard
fun CharSequence.windowed(size: Int, step: Int = 1, partialWindows: Boolean = false): List<String>

Returns a list of snapshots of the window of the given size sliding along this char sequence with the given step, where each snapshot is a string.

Since Kotlin

1.2
fun <R> CharSequence.windowed(size: Int, step: Int = 1, partialWindows: Boolean = false, transform: (CharSequence) -> R): List<R>

Returns a list of results of applying the given transform function to an each char sequence representing a view over the window of the given size sliding along this char sequence with the given step.

Since Kotlin

1.2
windowedSequence
Link copied to clipboard
fun CharSequence.windowedSequence(size: Int, step: Int = 1, partialWindows: Boolean = false): Sequence<String>

Returns a sequence of snapshots of the window of the given size sliding along this char sequence with the given step, where each snapshot is a string.

Since Kotlin

1.2
fun <R> CharSequence.windowedSequence(size: Int, step: Int = 1, partialWindows: Boolean = false, transform: (CharSequence) -> R): Sequence<R>

Returns a sequence of results of applying the given transform function to an each char sequence representing a view over the window of the given size sliding along this char sequence with the given step.

Since Kotlin

1.2
withIndex
Link copied to clipboard
fun CharSequence.withIndex(): Iterable<IndexedValue<Char>>

Returns a lazy Iterable that wraps each character of the original char sequence into an IndexedValue containing the index of that character and the character itself.

zip
Link copied to clipboard
infix fun CharSequence.zip(other: CharSequence): List<Pair<Char, Char>>

Returns a list of pairs built from the characters of this and the other char sequences with the same index The returned list has length of the shortest char sequence.

inline fun <V> CharSequence.zip(other: CharSequence, transform: (a: Char, b: Char) -> V): List<V>

Returns a list of values built from the characters of this and the other char sequences with the same index using the provided transform function applied to each pair of characters. The returned list has length of the shortest char sequence.

zipWithNext
Link copied to clipboard
fun CharSequence.zipWithNext(): List<Pair<Char, Char>>

Returns a list of pairs of each two adjacent characters in this char sequence.

Since Kotlin

1.2
inline fun <R> CharSequence.zipWithNext(transform: (a: Char, b: Char) -> R): List<R>

Returns a list containing the results of applying the given transform function to an each pair of two adjacent characters in this char sequence.

Since Kotlin

1.2

Properties

CASE_INSENSITIVE_ORDER
Link copied to clipboard
expect val String.Companion.CASE_INSENSITIVE_ORDER: Comparator<String>

A Comparator that orders strings ignoring character case.

actual val String.Companion.CASE_INSENSITIVE_ORDER: Comparator<String>

A Comparator that orders strings ignoring character case.

actual val String.Companion.CASE_INSENSITIVE_ORDER: Comparator<String>
actual val String.Companion.CASE_INSENSITIVE_ORDER: Comparator<String>
category
Link copied to clipboard
expect val Char.category: CharCategory

Returns the Unicode general category of this character.

actual val Char.category: CharCategory

Returns the Unicode general category of this character.

actual val Char.category: CharCategory

Returns the Unicode general category of this character.

actual val Char.category: CharCategory

Returns the Unicode general category of this character.

directionality
Link copied to clipboard
val Char.directionality: CharDirectionality

Returns the Unicode directionality property for the given character.

indices
Link copied to clipboard
val CharSequence.indices: IntRange

Returns the range of valid character indices for this char sequence.

lastIndex
Link copied to clipboard
val CharSequence.lastIndex: Int

Returns the index of the last character in the char sequence or -1 if it is empty.