Package-level declarations

Functions

Link copied to clipboard
external fun CharArray.concatToString(startIndex: Int, endIndex: Int): String
Link copied to clipboard

Returns whether this string contains char.

Link copied to clipboard
Link copied to clipboard
fun String.indexOf(char: Char, startIndex: Int = 0): Int

Finds the first matching character at or after startIndex, clamped to zero.

fun String.indexOf(other: String, startIndex: Int = 0): Int
Link copied to clipboard

Returns whether this string is empty or contains only whitespace.

Link copied to clipboard

Returns whether this string contains no characters.

Link copied to clipboard

Returns whether this string contains a non-whitespace character.

Link copied to clipboard

Returns whether this string contains at least one character.

Link copied to clipboard

Returns whether this UTF-16 character is Kotlin whitespace.

Link copied to clipboard

Finds the last matching character.

Finds the last matching substring, starting at the last character.

fun String.lastIndexOf(char: Char, startIndex: Int): Int

Searches backwards from startIndex for char.

fun String.lastIndexOf(string: String, startIndex: Int): Int

Searches backwards from startIndex for string, comparing UTF-16 code units.

Link copied to clipboard

Splits on CRLF, LF or CR, retaining empty lines including the final line.

Link copied to clipboard

Removes prefix when present, otherwise returns this string.

Link copied to clipboard

Removes suffix when present, otherwise returns this string.

Link copied to clipboard
fun String.replace(oldChar: Char, newChar: Char): String

Replaces every oldChar with newChar, comparing case-sensitively.

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

Replaces nonoverlapping oldValue matches. An empty oldValue inserts newValue at every UTF-16 boundary.

Link copied to clipboard
fun String.split(delimiter: Char, limit: Int = 0): List<String>

Splits on delimiter, retaining empty parts. Zero limit means no limit; positive limit keeps the remaining suffix.

fun String.split(delimiter: String, limit: Int = 0): List<String>

Splits on delimiter, retaining empty parts. An empty delimiter separates UTF-16 code units, including empty ends.

Link copied to clipboard
Link copied to clipboard
fun String.substringAfter(delimiter: Char): String

Returns the part after the first delimiter, or this string if absent.

fun String.substringAfter(delimiter: Char, missingDelimiterValue: String): String
fun String.substringAfter(delimiter: String, missingDelimiterValue: String): String

Returns the part after the first delimiter, or missingDelimiterValue if absent.

Link copied to clipboard

Returns the part after the last delimiter, or this string if absent.

fun String.substringAfterLast(delimiter: Char, missingDelimiterValue: String): String
fun String.substringAfterLast(delimiter: String, missingDelimiterValue: String): String

Returns the part after the last delimiter, or missingDelimiterValue if absent.

Link copied to clipboard

Returns the part before the first delimiter, or this string if absent.

fun String.substringBefore(delimiter: Char, missingDelimiterValue: String): String
fun String.substringBefore(delimiter: String, missingDelimiterValue: String): String

Returns the part before the first delimiter, or missingDelimiterValue if absent.

Link copied to clipboard

Returns the part before the last delimiter, or this string if absent.

fun String.substringBeforeLast(delimiter: Char, missingDelimiterValue: String): String
fun String.substringBeforeLast(delimiter: String, missingDelimiterValue: String): String

Returns the part before the last delimiter, or missingDelimiterValue if absent.

Link copied to clipboard

Parses a signed decimal Int, or returns null for invalid input or overflow.

Link copied to clipboard

Removes leading and trailing whitespace.

Link copied to clipboard

Removes trailing whitespace.

Link copied to clipboard

Removes leading whitespace.