StringBuilder

A mutable sequence of characters.

String builder can be used to efficiently perform multiple string manipulation operations.

Since Kotlin

1.0

A mutable sequence of characters.

String builder can be used to efficiently perform multiple string manipulation operations.

Since Kotlin

1.1

Since Kotlin

1.1

A mutable sequence of characters.

String builder can be used to efficiently perform multiple string manipulation operations.

Since Kotlin

1.3

Constructors

Link copied to clipboard
expect constructor()

Constructs an empty string builder.

expect constructor(capacity: Int)

Constructs an empty string builder with the specified initial capacity.

expect constructor(content: CharSequence)

Constructs a string builder that contains the same characters as the specified content char sequence.

expect constructor(content: String)

Constructs a string builder that contains the same characters as the specified content string.

actual constructor()

Constructs an empty string builder.

actual constructor(capacity: Int)

Constructs an empty string builder with the specified initial capacity.

actual constructor(content: CharSequence)

Constructs a string builder that contains the same characters as the specified content char sequence.

actual constructor(content: String)
actual constructor()

Constructs an empty string builder.

actual constructor(capacity: Int)

Constructs an empty string builder with the specified initial capacity.

actual constructor(content: CharSequence)

Constructs a string builder that contains the same characters as the specified content char sequence.

actual constructor(content: String)

Constructs a string builder that contains the same characters as the specified content string.

Properties

Link copied to clipboard

Returns the range of valid character indices for this char sequence.

Since Kotlin 1.0
Link copied to clipboard

Returns the index of the last character in the char sequence or -1 if it is empty.

Since Kotlin 1.0
Link copied to clipboard
expect open override val length: Int

Returns the length of this character sequence.

Since Kotlin 1.0
actual open override val length: Int

Returns the length of this character sequence.

Since Kotlin 1.1
actual open override val length: Int

Returns the length of this character sequence.

Since Kotlin 1.3

Functions

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

Returns true if all characters match the given predicate.

Since Kotlin 1.0
Link copied to clipboard

Returns true if char sequence has at least one character.

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

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

Since Kotlin 1.0
Link copied to clipboard
expect fun append(value: Any?): StringBuilder

Appends the string representation of the specified object value to this string builder and returns this instance.

Since Kotlin 1.0
expect fun append(value: Boolean): StringBuilder

Appends the string representation of the specified boolean value to this string builder and returns this instance.

Since Kotlin 1.3
expect open override fun append(value: Char): StringBuilder

Appends the specified character value to this Appendable and returns this instance.

Since Kotlin 1.0
expect fun append(value: CharArray): StringBuilder

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

Since Kotlin 1.4
expect open override fun append(value: CharSequence?): StringBuilder

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

Since Kotlin 1.0
expect fun append(value: String?): StringBuilder

Appends the specified string value to this string builder and returns this instance.

Since Kotlin 1.3
expect open override fun append(value: CharSequence?, startIndex: Int, endIndex: Int): StringBuilder

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

Since Kotlin 1.0
actual fun append(value: Any?): StringBuilder

Appends the string representation of the specified object value to this string builder and returns this instance.

Since Kotlin 1.1
actual fun append(value: Boolean): StringBuilder

Appends the string representation of the specified boolean value to this string builder and returns this instance.

Since Kotlin 1.3
actual open override fun append(value: Char): StringBuilder

Appends the specified character value to this Appendable and returns this instance.

Since Kotlin 1.1
actual fun append(value: CharArray): StringBuilder

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

Since Kotlin 1.4
actual open override fun append(value: CharSequence?): StringBuilder

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

Since Kotlin 1.1
actual fun append(value: String?): StringBuilder

Appends the specified string value to this string builder and returns this instance.

Since Kotlin 1.3
actual open override fun append(value: CharSequence?, startIndex: Int, endIndex: Int): StringBuilder

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

Since Kotlin 1.1
actual fun append(value: Any?): StringBuilder

Appends the string representation of the specified object value to this string builder and returns this instance.

Since Kotlin 1.3
actual fun append(value: Boolean): StringBuilder

Appends the string representation of the specified boolean value to this string builder and returns this instance.

Since Kotlin 1.3
fun append(value: Int): StringBuilder
Since Kotlin 1.3
actual open override fun append(value: Char): StringBuilder

Appends the specified character value to this Appendable and returns this instance.

Since Kotlin 1.3
actual fun append(value: CharArray): StringBuilder

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

Since Kotlin 1.3
actual open override fun append(value: CharSequence?): StringBuilder

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

Since Kotlin 1.3
actual fun append(value: String?): StringBuilder

Appends the specified string value to this string builder and returns this instance.

Since Kotlin 1.3
actual open override fun append(value: CharSequence?, startIndex: Int, endIndex: Int): StringBuilder

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

Since Kotlin 1.3
Link copied to clipboard
Since Kotlin 1.0
fun StringBuilder.append(vararg value: Any?): StringBuilder

Appends all arguments to the given StringBuilder.

Since Kotlin 1.0
Link copied to clipboard

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

Since Kotlin 1.4

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

Since Kotlin 1.4
inline fun Appendable.appendLine(value: Char): Appendable

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

Since Kotlin 1.4

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

Since Kotlin 1.4

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

Since Kotlin 1.4

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

Since Kotlin 1.4
Link copied to clipboard

Appends a line separator to this Appendable.

Since Kotlin 1.0

Appends a line separator to this StringBuilder.

Since Kotlin 1.0
inline fun Appendable.appendln(value: Char): Appendable

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

Since Kotlin 1.0

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

Since Kotlin 1.0
Link copied to clipboard
fun 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
fun 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
fun 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
fun 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
Link copied to clipboard
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
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
Link copied to clipboard

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

Since Kotlin 1.0
Link copied to clipboard

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

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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
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
Link copied to clipboard
expect fun capacity(): Int

Returns the current capacity of this string builder.

Since Kotlin 1.3
actual fun capacity(): Int

Returns the current capacity of this string builder.

Since Kotlin 1.3
actual fun capacity(): Int

Returns the current capacity of this string builder.

Since Kotlin 1.3
Link copied to clipboard

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
Link copied to clipboard

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
Link copied to clipboard

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

Since Kotlin 1.3
Link copied to clipboard

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

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

Since Kotlin 1.3

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

Since Kotlin 1.3
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

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

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

Since Kotlin 1.0
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.

Since Kotlin 1.0
Link copied to clipboard
inline fun CharSequence.count(): Int

Returns the length of this char sequence.

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

Returns the number of characters matching the given predicate.

Since Kotlin 1.0
Link copied to clipboard

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

Since Kotlin 1.4

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

Since Kotlin 1.4
Link copied to clipboard

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
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
Link copied to clipboard

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

Since Kotlin 1.3
Link copied to clipboard
fun deleteRange(startIndex: Int, endIndex: Int): StringBuilder

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

Since Kotlin 1.4
fun deleteRange(startIndex: Int, endIndex: Int): StringBuilder

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

Since Kotlin 1.4
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
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
Link copied to clipboard

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

Since Kotlin 1.0
Link copied to clipboard

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

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.1
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.

Since Kotlin 1.0
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.

Since Kotlin 1.3
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.

Since Kotlin 1.0
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.

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

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

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

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

Since Kotlin 1.0
Link copied to clipboard
expect fun ensureCapacity(minimumCapacity: Int)

Ensures that the capacity of this string builder is at least equal to the specified minimumCapacity.

Since Kotlin 1.4
actual fun ensureCapacity(minimumCapacity: Int)

Ensures that the capacity of this string builder is at least equal to the specified minimumCapacity.

Since Kotlin 1.4
actual fun ensureCapacity(minimumCapacity: Int)

Ensures that the capacity of this string builder is at least equal to the specified minimumCapacity.

Since Kotlin 1.3
Link copied to clipboard
inline fun StringBuilder.ensureCapacity(capacity: Int)
Since Kotlin 1.3
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
Link copied to clipboard

Returns first character.

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

Returns the first character matching the given predicate.

Since Kotlin 1.0
Link copied to clipboard

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

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

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

Since Kotlin 1.0
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.

Since Kotlin 1.0
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
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
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.

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

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

Since Kotlin 1.0
Link copied to clipboard
inline fun <R> CharSequence.foldIndexed(initial: R, operation: (index: Int, acc: 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.

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

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

Since Kotlin 1.0
Link copied to clipboard
inline fun <R> CharSequence.foldRightIndexed(initial: R, operation: (index: Int, Char, acc: 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.

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

Performs the given action on each character.

Since Kotlin 1.0
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.

Since Kotlin 1.0
Link copied to clipboard
expect open operator override fun get(index: Int): Char

Returns the character at the specified index in this character sequence.

Since Kotlin 1.0
actual open operator override fun get(index: Int): Char

Returns the character at the specified index in this character sequence.

Since Kotlin 1.1
actual open operator override fun get(index: Int): Char

Returns the character at the specified index in this character sequence.

Since Kotlin 1.3
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.

Since Kotlin 1.0
Link copied to clipboard

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

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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
Link copied to clipboard

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

Since Kotlin 1.0
Link copied to clipboard
expect fun indexOf(string: String): Int

Returns the index within this string builder of the first occurrence of the specified string.

Since Kotlin 1.4
expect fun indexOf(string: String, startIndex: Int): Int

Returns the index within this string builder of the first occurrence of the specified string, starting at the specified startIndex.

Since Kotlin 1.4
actual fun indexOf(string: String): Int

Returns the index within this string builder of the first occurrence of the specified string.

Since Kotlin 1.4
actual fun indexOf(string: String, startIndex: Int): Int

Returns the index within this string builder of the first occurrence of the specified string, starting at the specified startIndex.

Since Kotlin 1.4
actual fun indexOf(string: String): Int

Returns the index within this string builder of the first occurrence of the specified string.

Since Kotlin 1.4
actual fun indexOf(string: String, startIndex: Int): Int

Returns the index within this string builder of the first occurrence of the specified string, starting at the specified startIndex.

Since Kotlin 1.4
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
Link copied to clipboard
expect fun insert(index: Int, value: Any?): StringBuilder

Inserts the string representation of the specified object value into this string builder at the specified index and returns this instance.

Since Kotlin 1.4
expect fun insert(index: Int, value: Boolean): StringBuilder

Inserts the string representation of the specified boolean value into this string builder at the specified index and returns this instance.

Since Kotlin 1.4
expect fun insert(index: Int, value: Char): StringBuilder

Inserts the specified character value into this string builder at the specified index and returns this instance.

Since Kotlin 1.4
expect fun insert(index: Int, value: CharArray): StringBuilder

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

Since Kotlin 1.4
expect fun insert(index: Int, value: CharSequence?): StringBuilder

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

Since Kotlin 1.4
expect fun insert(index: Int, value: String?): StringBuilder

Inserts the string value into this string builder at the specified index and returns this instance.

Since Kotlin 1.4
actual fun insert(index: Int, value: Any?): StringBuilder

Inserts the string representation of the specified object value into this string builder at the specified index and returns this instance.

Since Kotlin 1.4
actual fun insert(index: Int, value: Boolean): StringBuilder

Inserts the string representation of the specified boolean value into this string builder at the specified index and returns this instance.

Since Kotlin 1.4
actual fun insert(index: Int, value: Char): StringBuilder

Inserts the specified character value into this string builder at the specified index and returns this instance.

Since Kotlin 1.4
actual fun insert(index: Int, value: CharArray): StringBuilder

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

Since Kotlin 1.4
actual fun insert(index: Int, value: CharSequence?): StringBuilder

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

Since Kotlin 1.4
actual fun insert(index: Int, value: String?): StringBuilder

Inserts the string value into this string builder at the specified index and returns this instance.

Since Kotlin 1.4
actual fun insert(index: Int, value: Any?): StringBuilder

Inserts the string representation of the specified object value into this string builder at the specified index and returns this instance.

Since Kotlin 1.3
actual fun insert(index: Int, value: Boolean): StringBuilder

Inserts the string representation of the specified boolean value into this string builder at the specified index and returns this instance.

Since Kotlin 1.3
fun insert(index: Int, value: Byte): StringBuilder
fun insert(index: Int, value: Double): StringBuilder
fun insert(index: Int, value: Float): StringBuilder
fun insert(index: Int, value: Int): StringBuilder
fun insert(index: Int, value: Long): StringBuilder
fun insert(index: Int, value: Short): StringBuilder
Since Kotlin 1.3
actual fun insert(index: Int, value: Char): StringBuilder

Inserts the specified character value into this string builder at the specified index and returns this instance.

Since Kotlin 1.3
actual fun insert(index: Int, value: CharArray): StringBuilder

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

Since Kotlin 1.3
actual fun insert(index: Int, value: CharSequence?): StringBuilder

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

Since Kotlin 1.3
actual fun insert(index: Int, value: String?): StringBuilder

Inserts the string value into this string builder at the specified index and returns this instance.

Since Kotlin 1.3
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, string: String): StringBuilder
Since Kotlin 1.3
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.

Since Kotlin 1.3
Link copied to clipboard
fun 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
fun 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
fun 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
fun 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
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
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
Link copied to clipboard
Since Kotlin 1.0

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

Since Kotlin 1.1

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

Since Kotlin 1.0

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

Since Kotlin 1.3
Link copied to clipboard

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

Since Kotlin 1.0
Link copied to clipboard

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

Since Kotlin 1.0
Link copied to clipboard

Returns true if this char sequence is not empty.

Since Kotlin 1.0
Link copied to clipboard

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

Since Kotlin 1.0
Link copied to clipboard

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

Since Kotlin 1.0
Link copied to clipboard

Iterator for characters of the given char sequence.

Since Kotlin 1.0
Link copied to clipboard

Returns the last character.

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

Returns the last character matching the given predicate.

Since Kotlin 1.0
Link copied to clipboard
expect fun lastIndexOf(string: String): Int

Returns the index within this string builder of the last occurrence of the specified string. The last occurrence of empty string "" is considered to be at the index equal to this.length.

Since Kotlin 1.4
expect fun lastIndexOf(string: String, startIndex: Int): Int

Returns the index within this string builder of the last occurrence of the specified string, starting from the specified startIndex toward the beginning.

Since Kotlin 1.4
actual fun lastIndexOf(string: String): Int

Returns the index within this string builder of the last occurrence of the specified string. The last occurrence of empty string "" is considered to be at the index equal to this.length.

Since Kotlin 1.4
actual fun lastIndexOf(string: String, startIndex: Int): Int

Returns the index within this string builder of the last occurrence of the specified string, starting from the specified startIndex toward the beginning.

Since Kotlin 1.4
actual fun lastIndexOf(string: String): Int

Returns the index within this string builder of the last occurrence of the specified string. The last occurrence of empty string "" is considered to be at the index equal to this.length.

Since Kotlin 1.4
actual fun lastIndexOf(string: String, startIndex: Int): Int

Returns the index within this string builder of the last occurrence of the specified string, starting from the specified startIndex toward the beginning.

Since Kotlin 1.4
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
Link copied to clipboard

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

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

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

Since Kotlin 1.0
Link copied to clipboard

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

Since Kotlin 1.0
Link copied to clipboard

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

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
Link copied to clipboard
infix inline fun CharSequence.matches(regex: Regex): Boolean

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

Since Kotlin 1.0
Link copied to clipboard
Since Kotlin 1.0
Link copied to clipboard
inline fun <R : Comparable<R>> CharSequence.maxBy(selector: (Char) -> R): Char?
Since Kotlin 1.0
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
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
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
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
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
Link copied to clipboard

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

Since Kotlin 1.4
Link copied to clipboard
fun CharSequence.maxWith(comparator: Comparator<in Char>): Char?
Since Kotlin 1.0
Link copied to clipboard

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

Since Kotlin 1.4
Link copied to clipboard
Since Kotlin 1.0
Link copied to clipboard
inline fun <R : Comparable<R>> CharSequence.minBy(selector: (Char) -> R): Char?
Since Kotlin 1.0
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
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
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
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
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
Link copied to clipboard

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

Since Kotlin 1.4
Link copied to clipboard
fun CharSequence.minWith(comparator: Comparator<in Char>): Char?
Since Kotlin 1.0
Link copied to clipboard

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

Since Kotlin 1.4
Link copied to clipboard

Returns true if the char sequence has no characters.

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

Returns true if no characters match the given predicate.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
Link copied to clipboard

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.

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

Returns a random character from this char sequence.

Since Kotlin 1.3

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

Since Kotlin 1.3
Link copied to clipboard

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

Since Kotlin 1.4

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
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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
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
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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
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
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.

Since Kotlin 1.0
actual fun CharSequence.regionMatches(thisOffset: Int, other: CharSequence, otherOffset: Int, length: Int, ignoreCase: Boolean = false): Boolean
Since Kotlin 1.1
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.

Since Kotlin 1.0
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.

Since Kotlin 1.3
Link copied to clipboard

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.

Since Kotlin 1.0
Link copied to clipboard

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

Since Kotlin 1.0
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.

Since Kotlin 1.0
Link copied to clipboard

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.

Since Kotlin 1.0
Link copied to clipboard

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.

Since Kotlin 1.0

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.

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

Returns a string containing this char sequence repeated n times.

Since Kotlin 1.0
actual fun CharSequence.repeat(n: Int): String

Returns a string containing this char sequence repeated n times.

Since Kotlin 1.1
actual fun CharSequence.repeat(n: Int): String

Returns a string containing this char sequence repeated n times.

Since Kotlin 1.0
actual fun CharSequence.repeat(n: Int): String

Returns a string containing this char sequence repeated n times.

Since Kotlin 1.3
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
Link copied to clipboard

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

Since Kotlin 1.0
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.

Since Kotlin 1.0
Link copied to clipboard
expect fun reverse(): StringBuilder

Reverses the contents of this string builder and returns this instance.

Since Kotlin 1.0
actual fun reverse(): StringBuilder

Reverses the contents of this string builder and returns this instance.

Since Kotlin 1.1
actual fun reverse(): StringBuilder

Reverses the contents of this string builder and returns this instance.

Since Kotlin 1.3
Link copied to clipboard

Returns a char sequence with characters in reversed order.

Since Kotlin 1.0
Link copied to clipboard
inline fun <R> CharSequence.runningFold(initial: R, operation: (acc: 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
Link copied to clipboard
inline fun <R> CharSequence.runningFoldIndexed(initial: R, operation: (index: Int, acc: 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
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
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
Link copied to clipboard
inline fun <R> CharSequence.scan(initial: R, operation: (acc: 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
Link copied to clipboard
inline fun <R> CharSequence.scanIndexed(initial: R, operation: (index: Int, acc: 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
Link copied to clipboard
operator fun set(index: Int, value: Char)

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

Since Kotlin 1.4
operator fun set(index: Int, value: Char)

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

Since Kotlin 1.3
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.

Since Kotlin 1.0
actual inline operator fun StringBuilder.set(index: Int, value: Char)

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

Since Kotlin 1.3
Link copied to clipboard
inline fun StringBuilder.setCharAt(index: Int, value: Char)
Since Kotlin 1.3
Link copied to clipboard
expect fun setLength(newLength: Int)

Sets the length of this string builder to the specified newLength.

Since Kotlin 1.4
actual fun setLength(newLength: Int)

Sets the length of this string builder to the specified newLength.

Since Kotlin 1.4
actual fun setLength(newLength: Int)

Sets the length of this string builder to the specified newLength.

Since Kotlin 1.3
Link copied to clipboard
inline fun StringBuilder.setLength(l: Int)
Since Kotlin 1.3
Link copied to clipboard
fun 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
fun 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
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
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
Link copied to clipboard

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

Since Kotlin 1.0
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.

Since Kotlin 1.0
Link copied to clipboard

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

Since Kotlin 1.0
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.

Since Kotlin 1.0
Link copied to clipboard

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

Since Kotlin 1.0

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

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

Splits this char sequence to a list of strings around matches of the given regular expression.

Since Kotlin 1.0
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.

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

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

Since Kotlin 1.0
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.

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

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

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

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

Since Kotlin 1.0
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.

Since Kotlin 1.0
Link copied to clipboard
expect open override fun subSequence(startIndex: Int, endIndex: Int): CharSequence

Returns a new character sequence that is a subsequence of this character sequence, starting at the specified startIndex and ending right before the specified endIndex.

Since Kotlin 1.0
actual open override fun subSequence(startIndex: Int, endIndex: Int): CharSequence

Returns a new character sequence that is a subsequence of this character sequence, starting at the specified startIndex and ending right before the specified endIndex.

Since Kotlin 1.1
actual open override fun subSequence(startIndex: Int, endIndex: Int): CharSequence

Returns a new character sequence that is a subsequence of this character sequence, starting at the specified startIndex and ending right before the specified endIndex.

Since Kotlin 1.3
Link copied to clipboard

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

Since Kotlin 1.0
Link copied to clipboard
expect fun substring(startIndex: Int): String

Returns a new String that contains characters in this string builder at startIndex (inclusive) and up to the length (exclusive).

Since Kotlin 1.4
expect fun substring(startIndex: Int, endIndex: Int): String

Returns a new String that contains characters in this string builder at startIndex (inclusive) and up to the endIndex (exclusive).

Since Kotlin 1.4
actual fun substring(startIndex: Int): String

Returns a new String that contains characters in this string builder at startIndex (inclusive) and up to the length (exclusive).

Since Kotlin 1.4
actual fun substring(startIndex: Int, endIndex: Int): String

Returns a new String that contains characters in this string builder at startIndex (inclusive) and up to the endIndex (exclusive).

Since Kotlin 1.4
actual fun substring(startIndex: Int): String

Returns a new String that contains characters in this string builder at startIndex (inclusive) and up to the length (exclusive).

Since Kotlin 1.4
actual fun substring(startIndex: Int, endIndex: Int): String

Returns a new String that contains characters in this string builder at startIndex (inclusive) and up to the endIndex (exclusive).

Since Kotlin 1.3
Link copied to clipboard

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

Since Kotlin 1.0
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.

Since Kotlin 1.0
Link copied to clipboard
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.

Since Kotlin 1.0
Link copied to clipboard
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.

Since Kotlin 1.0
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 = "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
Link copied to clipboard

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.

Since Kotlin 1.0
Link copied to clipboard

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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
Link copied to clipboard
fun 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
fun 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
Link copied to clipboard
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 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 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 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
Link copied to clipboard
fun <C : MutableCollection<in Char>> CharSequence.toCollection(destination: C): C

Appends all characters to the given destination collection.

Since Kotlin 1.0
Link copied to clipboard

Returns a new HashSet of all characters.

Since Kotlin 1.0
Link copied to clipboard

Returns a List containing all characters.

Since Kotlin 1.0
Link copied to clipboard

Returns a new MutableList filled with all characters of this char sequence.

Since Kotlin 1.0
Link copied to clipboard

Returns a Set of all characters.

Since Kotlin 1.0
Link copied to clipboard

Returns a new SortedSet of all characters.

Since Kotlin 1.0
Link copied to clipboard
open override fun toString(): String
Since Kotlin 1.1
open override fun toString(): String
Since Kotlin 1.3
Link copied to clipboard

Returns a sub sequence of this char sequence having leading and trailing whitespace removed.

Since Kotlin 1.0
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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
Link copied to clipboard

Returns a sub sequence of this char sequence having trailing whitespace removed.

Since Kotlin 1.0

Returns a sub sequence of this char sequence having trailing characters from the chars array removed.

Since Kotlin 1.0
inline fun CharSequence.trimEnd(predicate: (Char) -> Boolean): CharSequence

Returns a sub sequence of this char sequence having trailing characters matching the predicate removed.

Since Kotlin 1.0
Link copied to clipboard

Returns a sub sequence of this char sequence having leading whitespace removed.

Since Kotlin 1.0

Returns a sub sequence of this char sequence having leading characters from the chars array removed.

Since Kotlin 1.0
inline fun CharSequence.trimStart(predicate: (Char) -> Boolean): CharSequence

Returns a sub sequence of this char sequence having leading characters matching the predicate removed.

Since Kotlin 1.0
Link copied to clipboard
expect fun trimToSize()

Attempts to reduce storage used for this string builder.

Since Kotlin 1.4
actual fun trimToSize()

Attempts to reduce storage used for this string builder.

Since Kotlin 1.4
actual fun trimToSize()

Attempts to reduce storage used for this string builder.

Since Kotlin 1.3
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
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
Link copied to clipboard

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.

Since Kotlin 1.0
Link copied to clipboard

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.

Since Kotlin 1.0
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.

Since Kotlin 1.0
Link copied to clipboard

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