[stdlib] Explicit visibility and return types: StringBuilder

This commit is contained in:
Ilya Gorbunov
2023-09-19 14:36:31 +02:00
committed by Space Team
parent 92b3131c12
commit da1d3be7f2
3 changed files with 128 additions and 128 deletions
@@ -10,20 +10,20 @@ package kotlin.text
*
* String builder can be used to efficiently perform multiple string manipulation operations.
*/
public actual class StringBuilder actual constructor(content: String) : Appendable, CharSequence {
public actual class StringBuilder public actual constructor(content: String) : Appendable, CharSequence {
/**
* Constructs an empty string builder with the specified initial [capacity].
*
* In Kotlin/JS implementation of StringBuilder the initial capacity has no effect on the further performance of operations.
*/
actual constructor(capacity: Int) : this() {
public actual constructor(capacity: Int) : this() {
}
/** Constructs a string builder that contains the same characters as the specified [content] char sequence. */
actual constructor(content: CharSequence) : this(content.toString()) {}
public actual constructor(content: CharSequence) : this(content.toString()) {}
/** Constructs an empty string builder. */
actual constructor() : this("")
public actual constructor() : this("")
private var string: String = if (content !== undefined) content else ""
@@ -57,7 +57,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* Note that the reverse operation may produce new surrogate pairs that were unpaired low-surrogates and high-surrogates before the operation.
* For example, reversing `"\uDC00\uD800"` produces `"\uD800\uDC00"` which is a valid surrogate pair.
*/
actual fun reverse(): StringBuilder {
public actual fun reverse(): StringBuilder {
var reversed = ""
var index = string.length - 1
while (index >= 0) {
@@ -83,7 +83,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
* and then that string was appended to this string builder.
*/
actual fun append(value: Any?): StringBuilder {
public actual fun append(value: Any?): StringBuilder {
string += value.toString()
return this
}
@@ -95,7 +95,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* and then that string was appended to this string builder.
*/
@SinceKotlin("1.3")
actual fun append(value: Boolean): StringBuilder {
public actual fun append(value: Boolean): StringBuilder {
string += value
return this
}
@@ -107,7 +107,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* and then that string was appended to this string builder.
*/
@SinceKotlin("1.9")
actual fun append(value: Byte): StringBuilder = append(value.toString())
public actual fun append(value: Byte): StringBuilder = append(value.toString())
/**
* Appends the string representation of the specified short [value] to this string builder and returns this instance.
@@ -116,7 +116,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* and then that string was appended to this string builder.
*/
@SinceKotlin("1.9")
actual fun append(value: Short): StringBuilder = append(value.toString())
public actual fun append(value: Short): StringBuilder = append(value.toString())
/**
* Appends the string representation of the specified int [value] to this string builder and returns this instance.
@@ -125,7 +125,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* and then that string was appended to this string builder.
*/
@SinceKotlin("1.9")
actual fun append(value: Int): StringBuilder = append(value.toString())
public actual fun append(value: Int): StringBuilder = append(value.toString())
/**
* Appends the string representation of the specified long [value] to this string builder and returns this instance.
@@ -134,7 +134,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* and then that string was appended to this string builder.
*/
@SinceKotlin("1.9")
actual fun append(value: Long): StringBuilder = append(value.toString())
public actual fun append(value: Long): StringBuilder = append(value.toString())
/**
* Appends the string representation of the specified float [value] to this string builder and returns this instance.
@@ -143,7 +143,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* and then that string was appended to this string builder.
*/
@SinceKotlin("1.9")
actual fun append(value: Float): StringBuilder = append(value.toString())
public actual fun append(value: Float): StringBuilder = append(value.toString())
/**
* Appends the string representation of the specified double [value] to this string builder and returns this instance.
@@ -152,7 +152,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* and then that string was appended to this string builder.
*/
@SinceKotlin("1.9")
actual fun append(value: Double): StringBuilder = append(value.toString())
public actual fun append(value: Double): StringBuilder = append(value.toString())
/**
* Appends characters in the specified character array [value] to this string builder and returns this instance.
@@ -160,7 +160,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* Characters are appended in order, starting at the index 0.
*/
@SinceKotlin("1.4")
actual fun append(value: CharArray): StringBuilder {
public actual fun append(value: CharArray): StringBuilder {
string += value.concatToString()
return this
}
@@ -171,7 +171,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* If [value] is `null`, then the four characters `"null"` are appended.
*/
@SinceKotlin("1.3")
actual fun append(value: String?): StringBuilder {
public actual fun append(value: String?): StringBuilder {
this.string += value ?: "null"
return this
}
@@ -186,7 +186,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
@SinceKotlin("1.3")
// @ExperimentalStdlibApi
@Deprecated("Obtaining StringBuilder capacity is not supported in JS and common code.", level = DeprecationLevel.WARNING)
actual fun capacity(): Int = length
public actual fun capacity(): Int = length
/**
* Ensures that the capacity of this string builder is at least equal to the specified [minimumCapacity].
@@ -198,7 +198,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* thus calling this method has no effect on the further performance of operations.
*/
@SinceKotlin("1.4")
actual fun ensureCapacity(minimumCapacity: Int) {
public actual fun ensureCapacity(minimumCapacity: Int) {
}
/**
@@ -207,7 +207,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* Returns `-1` if the specified [string] does not occur in this string builder.
*/
@SinceKotlin("1.4")
actual fun indexOf(string: String): Int = this.string.asDynamic().indexOf(string)
public actual fun indexOf(string: String): Int = this.string.asDynamic().indexOf(string)
/**
* Returns the index within this string builder of the first occurrence of the specified [string],
@@ -216,7 +216,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* Returns `-1` if the specified [string] does not occur in this string builder starting at the specified [startIndex].
*/
@SinceKotlin("1.4")
actual fun indexOf(string: String, startIndex: Int): Int = this.string.asDynamic().indexOf(string, startIndex)
public actual fun indexOf(string: String, startIndex: Int): Int = this.string.asDynamic().indexOf(string, startIndex)
/**
* Returns the index within this string builder of the last occurrence of the specified [string].
@@ -225,7 +225,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* Returns `-1` if the specified [string] does not occur in this string builder.
*/
@SinceKotlin("1.4")
actual fun lastIndexOf(string: String): Int = this.string.asDynamic().lastIndexOf(string)
public actual fun lastIndexOf(string: String): Int = this.string.asDynamic().lastIndexOf(string)
/**
* Returns the index within this string builder of the last occurrence of the specified [string],
@@ -234,7 +234,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* Returns `-1` if the specified [string] does not occur in this string builder starting at the specified [startIndex].
*/
@SinceKotlin("1.4")
actual fun lastIndexOf(string: String, startIndex: Int): Int {
public actual fun lastIndexOf(string: String, startIndex: Int): Int {
if (string.isEmpty() && startIndex < 0) return -1
return this.string.asDynamic().lastIndexOf(string, startIndex)
}
@@ -248,7 +248,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
actual fun insert(index: Int, value: Boolean): StringBuilder {
public actual fun insert(index: Int, value: Boolean): StringBuilder {
AbstractList.checkPositionIndex(index, length)
string = string.substring(0, index) + value + string.substring(index)
@@ -264,7 +264,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.9")
actual fun insert(index: Int, value: Byte): StringBuilder = insert(index, value.toString())
public actual fun insert(index: Int, value: Byte): StringBuilder = insert(index, value.toString())
/**
* Inserts the string representation of the specified short [value] into this string builder at the specified [index] and returns this instance.
@@ -275,7 +275,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.9")
actual fun insert(index: Int, value: Short): StringBuilder = insert(index, value.toString())
public actual fun insert(index: Int, value: Short): StringBuilder = insert(index, value.toString())
/**
* Inserts the string representation of the specified int [value] into this string builder at the specified [index] and returns this instance.
@@ -286,7 +286,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.9")
actual fun insert(index: Int, value: Int): StringBuilder = insert(index, value.toString())
public actual fun insert(index: Int, value: Int): StringBuilder = insert(index, value.toString())
/**
* Inserts the string representation of the specified long [value] into this string builder at the specified [index] and returns this instance.
@@ -297,7 +297,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.9")
actual fun insert(index: Int, value: Long): StringBuilder = insert(index, value.toString())
public actual fun insert(index: Int, value: Long): StringBuilder = insert(index, value.toString())
/**
* Inserts the string representation of the specified float [value] into this string builder at the specified [index] and returns this instance.
@@ -308,7 +308,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.9")
actual fun insert(index: Int, value: Float): StringBuilder = insert(index, value.toString())
public actual fun insert(index: Int, value: Float): StringBuilder = insert(index, value.toString())
/**
* Inserts the string representation of the specified double [value] into this string builder at the specified [index] and returns this instance.
@@ -319,7 +319,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.9")
actual fun insert(index: Int, value: Double): StringBuilder = insert(index, value.toString())
public actual fun insert(index: Int, value: Double): StringBuilder = insert(index, value.toString())
/**
* Inserts the specified character [value] into this string builder at the specified [index] and returns this instance.
@@ -327,7 +327,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
actual fun insert(index: Int, value: Char): StringBuilder {
public actual fun insert(index: Int, value: Char): StringBuilder {
AbstractList.checkPositionIndex(index, length)
string = string.substring(0, index) + value + string.substring(index)
@@ -342,7 +342,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
actual fun insert(index: Int, value: CharArray): StringBuilder {
public actual fun insert(index: Int, value: CharArray): StringBuilder {
AbstractList.checkPositionIndex(index, length)
string = string.substring(0, index) + value.concatToString() + string.substring(index)
@@ -360,7 +360,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
actual fun insert(index: Int, value: CharSequence?): StringBuilder {
public actual fun insert(index: Int, value: CharSequence?): StringBuilder {
AbstractList.checkPositionIndex(index, length)
string = string.substring(0, index) + value.toString() + string.substring(index)
@@ -376,7 +376,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
actual fun insert(index: Int, value: Any?): StringBuilder {
public actual fun insert(index: Int, value: Any?): StringBuilder {
AbstractList.checkPositionIndex(index, length)
string = string.substring(0, index) + value.toString() + string.substring(index)
@@ -391,7 +391,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
actual fun insert(index: Int, value: String?): StringBuilder {
public actual fun insert(index: Int, value: String?): StringBuilder {
AbstractList.checkPositionIndex(index, length)
val toInsert = value ?: "null"
@@ -411,7 +411,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* @throws IndexOutOfBoundsException or [IllegalArgumentException] if [newLength] is less than zero.
*/
@SinceKotlin("1.4")
actual fun setLength(newLength: Int) {
public actual fun setLength(newLength: Int) {
if (newLength < 0) {
throw IllegalArgumentException("Negative new length: $newLength.")
}
@@ -431,7 +431,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* @throws IndexOutOfBoundsException if [startIndex] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
actual fun substring(startIndex: Int): String {
public actual fun substring(startIndex: Int): String {
AbstractList.checkPositionIndex(startIndex, length)
return string.substring(startIndex)
@@ -443,7 +443,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this string builder indices or when `startIndex > endIndex`.
*/
@SinceKotlin("1.4")
actual fun substring(startIndex: Int, endIndex: Int): String {
public actual fun substring(startIndex: Int, endIndex: Int): String {
AbstractList.checkBoundsIndexes(startIndex, endIndex, length)
return string.substring(startIndex, endIndex)
@@ -459,7 +459,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* In Kotlin/JS implementation of StringBuilder the size of the backing storage is always equal to the length of the string builder.
*/
@SinceKotlin("1.4")
actual fun trimToSize() {
public actual fun trimToSize() {
}
override fun toString(): String = string
@@ -667,7 +667,7 @@ public actual inline fun StringBuilder.clear(): StringBuilder = this.clear()
*/
@SinceKotlin("1.4")
@Suppress("EXTENSION_SHADOWED_BY_MEMBER", "NOTHING_TO_INLINE")
public actual inline operator fun StringBuilder.set(index: Int, value: Char) = this.set(index, value)
public actual inline operator fun StringBuilder.set(index: Int, value: Char): Unit = this.set(index, value)
/**
* Replaces characters in the specified range of this string builder with characters in the specified string [value] and returns this instance.
@@ -722,7 +722,7 @@ public actual inline fun StringBuilder.deleteRange(startIndex: Int, endIndex: In
*/
@SinceKotlin("1.4")
@Suppress("EXTENSION_SHADOWED_BY_MEMBER", "NOTHING_TO_INLINE", "ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
public actual inline fun StringBuilder.toCharArray(destination: CharArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = this.length) =
public actual inline fun StringBuilder.toCharArray(destination: CharArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = this.length): Unit =
this.toCharArray(destination, destinationOffset, startIndex, endIndex)
/**
@@ -10,22 +10,22 @@ package kotlin.text
*
* String builder can be used to efficiently perform multiple string manipulation operations.
*/
actual class StringBuilder private constructor (
private var array: CharArray) : CharSequence, Appendable {
public actual class StringBuilder
private constructor (private var array: CharArray) : CharSequence, Appendable {
/** Constructs an empty string builder. */
actual constructor() : this(10)
public actual constructor() : this(10)
/** Constructs an empty string builder with the specified initial [capacity]. */
actual constructor(capacity: Int) : this(CharArray(capacity))
public actual constructor(capacity: Int) : this(CharArray(capacity))
/** Constructs a string builder that contains the same characters as the specified [content] string. */
actual constructor(content: String) : this(content.toCharArray()) {
public actual constructor(content: String) : this(content.toCharArray()) {
_length = array.size
}
/** Constructs a string builder that contains the same characters as the specified [content] char sequence. */
actual constructor(content: CharSequence): this(content.length) {
public actual constructor(content: CharSequence): this(content.length) {
append(content)
}
@@ -68,7 +68,7 @@ actual class StringBuilder private constructor (
* For example, reversing `"\uDC00\uD800"` produces `"\uD800\uDC00"` which is a valid surrogate pair.
*/
// Based on Apache Harmony implementation.
actual fun reverse(): StringBuilder {
public actual fun reverse(): StringBuilder {
if (this.length < 2) {
return this
}
@@ -140,7 +140,7 @@ actual class StringBuilder private constructor (
* The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
* and then that string was appended to this string builder.
*/
actual fun append(value: Any?): StringBuilder = append(value.toString())
public actual fun append(value: Any?): StringBuilder = append(value.toString())
// TODO: optimize the append overloads with primitive value!
@@ -150,7 +150,7 @@ actual class StringBuilder private constructor (
* The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
* and then that string was appended to this string builder.
*/
actual fun append(value: Boolean): StringBuilder = append(value.toString())
public actual fun append(value: Boolean): StringBuilder = append(value.toString())
/**
* Appends the string representation of the specified byte [value] to this string builder and returns this instance.
@@ -158,7 +158,7 @@ actual class StringBuilder private constructor (
* The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
* and then that string was appended to this string builder.
*/
actual fun append(value: Byte): StringBuilder = append(value.toString())
public actual fun append(value: Byte): StringBuilder = append(value.toString())
/**
* Appends the string representation of the specified short [value] to this string builder and returns this instance.
@@ -166,7 +166,7 @@ actual class StringBuilder private constructor (
* The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
* and then that string was appended to this string builder.
*/
actual fun append(value: Short): StringBuilder = append(value.toString())
public actual fun append(value: Short): StringBuilder = append(value.toString())
/**
* Appends the string representation of the specified int [value] to this string builder and returns this instance.
@@ -174,7 +174,7 @@ actual class StringBuilder private constructor (
* The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
* and then that string was appended to this string builder.
*/
actual fun append(value: Int): StringBuilder {
public actual fun append(value: Int): StringBuilder {
ensureExtraCapacity(11)
_length += insertInt(array, _length, value)
return this
@@ -186,7 +186,7 @@ actual class StringBuilder private constructor (
* The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
* and then that string was appended to this string builder.
*/
actual fun append(value: Long): StringBuilder = append(value.toString())
public actual fun append(value: Long): StringBuilder = append(value.toString())
/**
* Appends the string representation of the specified float [value] to this string builder and returns this instance.
@@ -194,7 +194,7 @@ actual class StringBuilder private constructor (
* The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
* and then that string was appended to this string builder.
*/
actual fun append(value: Float): StringBuilder = append(value.toString())
public actual fun append(value: Float): StringBuilder = append(value.toString())
/**
* Appends the string representation of the specified double [value] to this string builder and returns this instance.
@@ -202,14 +202,14 @@ actual class StringBuilder private constructor (
* The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
* and then that string was appended to this string builder.
*/
actual fun append(value: Double): StringBuilder = append(value.toString())
public actual fun append(value: Double): StringBuilder = append(value.toString())
/**
* Appends characters in the specified character array [value] to this string builder and returns this instance.
*
* Characters are appended in order, starting at the index 0.
*/
actual fun append(value: CharArray): StringBuilder {
public actual fun append(value: CharArray): StringBuilder {
ensureExtraCapacity(value.size)
value.copyInto(array, _length)
_length += value.size
@@ -221,7 +221,7 @@ actual class StringBuilder private constructor (
*
* If [value] is `null`, then the four characters `"null"` are appended.
*/
actual fun append(value: String?): StringBuilder {
public actual fun append(value: String?): StringBuilder {
val toAppend = value ?: "null"
ensureExtraCapacity(toAppend.length)
_length += insertString(array, _length, toAppend)
@@ -233,7 +233,7 @@ actual class StringBuilder private constructor (
*
* The capacity is the maximum length this string builder can have before an allocation occurs.
*/
actual fun capacity(): Int = array.size
public actual fun capacity(): Int = array.size
/**
* Ensures that the capacity of this string builder is at least equal to the specified [minimumCapacity].
@@ -241,7 +241,7 @@ actual class StringBuilder private constructor (
* If the current capacity is less than the [minimumCapacity], a new backing storage is allocated with greater capacity.
* Otherwise, this method takes no action and simply returns.
*/
actual fun ensureCapacity(minimumCapacity: Int) {
public actual fun ensureCapacity(minimumCapacity: Int) {
if (minimumCapacity <= array.size) return
ensureCapacityInternal(minimumCapacity)
}
@@ -252,7 +252,7 @@ actual class StringBuilder private constructor (
* Returns `-1` if the specified [string] does not occur in this string builder.
*/
@SinceKotlin("1.4")
actual fun indexOf(string: String): Int {
public actual fun indexOf(string: String): Int {
return (this as CharSequence).indexOf(string, startIndex = 0, ignoreCase = false)
}
@@ -263,7 +263,7 @@ actual class StringBuilder private constructor (
* Returns `-1` if the specified [string] does not occur in this string builder starting at the specified [startIndex].
*/
@SinceKotlin("1.4")
actual fun indexOf(string: String, startIndex: Int): Int {
public actual fun indexOf(string: String, startIndex: Int): Int {
if (string.isEmpty() && startIndex >= _length) return _length
return (this as CharSequence).indexOf(string, startIndex, ignoreCase = false)
}
@@ -275,7 +275,7 @@ actual class StringBuilder private constructor (
* Returns `-1` if the specified [string] does not occur in this string builder.
*/
@SinceKotlin("1.4")
actual fun lastIndexOf(string: String): Int {
public actual fun lastIndexOf(string: String): Int {
if (string.isEmpty()) return _length
return (this as CharSequence).lastIndexOf(string, startIndex = lastIndex, ignoreCase = false)
}
@@ -287,7 +287,7 @@ actual class StringBuilder private constructor (
* Returns `-1` if the specified [string] does not occur in this string builder starting at the specified [startIndex].
*/
@SinceKotlin("1.4")
actual fun lastIndexOf(string: String, startIndex: Int): Int {
public actual fun lastIndexOf(string: String, startIndex: Int): Int {
if (string.isEmpty() && startIndex >= _length) return _length
return (this as CharSequence).lastIndexOf(string, startIndex, ignoreCase = false)
}
@@ -302,7 +302,7 @@ actual class StringBuilder private constructor (
*
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
actual fun insert(index: Int, value: Boolean): StringBuilder = insert(index, value.toString())
public actual fun insert(index: Int, value: Boolean): StringBuilder = insert(index, value.toString())
/**
* Inserts the string representation of the specified byte [value] into this string builder at the specified [index] and returns this instance.
@@ -312,7 +312,7 @@ actual class StringBuilder private constructor (
*
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
actual fun insert(index: Int, value: Byte): StringBuilder = insert(index, value.toString())
public actual fun insert(index: Int, value: Byte): StringBuilder = insert(index, value.toString())
/**
* Inserts the string representation of the specified short [value] into this string builder at the specified [index] and returns this instance.
@@ -322,7 +322,7 @@ actual class StringBuilder private constructor (
*
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
actual fun insert(index: Int, value: Short): StringBuilder = insert(index, value.toString())
public actual fun insert(index: Int, value: Short): StringBuilder = insert(index, value.toString())
/**
* Inserts the string representation of the specified int [value] into this string builder at the specified [index] and returns this instance.
@@ -332,7 +332,7 @@ actual class StringBuilder private constructor (
*
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
actual fun insert(index: Int, value: Int): StringBuilder = insert(index, value.toString())
public actual fun insert(index: Int, value: Int): StringBuilder = insert(index, value.toString())
/**
* Inserts the string representation of the specified long [value] into this string builder at the specified [index] and returns this instance.
@@ -342,7 +342,7 @@ actual class StringBuilder private constructor (
*
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
actual fun insert(index: Int, value: Long): StringBuilder = insert(index, value.toString())
public actual fun insert(index: Int, value: Long): StringBuilder = insert(index, value.toString())
/**
* Inserts the string representation of the specified float [value] into this string builder at the specified [index] and returns this instance.
@@ -352,7 +352,7 @@ actual class StringBuilder private constructor (
*
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
actual fun insert(index: Int, value: Float): StringBuilder = insert(index, value.toString())
public actual fun insert(index: Int, value: Float): StringBuilder = insert(index, value.toString())
/**
* Inserts the string representation of the specified double [value] into this string builder at the specified [index] and returns this instance.
@@ -362,14 +362,14 @@ actual class StringBuilder private constructor (
*
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
actual fun insert(index: Int, value: Double): StringBuilder = insert(index, value.toString())
public actual fun insert(index: Int, value: Double): StringBuilder = insert(index, value.toString())
/**
* Inserts the specified character [value] into this string builder at the specified [index] and returns this instance.
*
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
actual fun insert(index: Int, value: Char): StringBuilder {
public actual fun insert(index: Int, value: Char): StringBuilder {
AbstractList.checkPositionIndex(index, _length)
ensureExtraCapacity(1)
val newLastIndex = lastIndex + 1
@@ -388,7 +388,7 @@ actual class StringBuilder private constructor (
*
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
actual fun insert(index: Int, value: CharArray): StringBuilder {
public actual fun insert(index: Int, value: CharArray): StringBuilder {
AbstractList.checkPositionIndex(index, _length)
ensureExtraCapacity(value.size)
@@ -409,7 +409,7 @@ actual class StringBuilder private constructor (
*
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
actual fun insert(index: Int, value: CharSequence?): StringBuilder {
public actual fun insert(index: Int, value: CharSequence?): StringBuilder {
// Kotlin/JVM inserts the "null" string if the argument is null.
val toInsert = value ?: "null"
return insertRange(index, toInsert, 0, toInsert.length)
@@ -423,7 +423,7 @@ actual class StringBuilder private constructor (
*
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
actual fun insert(index: Int, value: Any?): StringBuilder = insert(index, value.toString())
public actual fun insert(index: Int, value: Any?): StringBuilder = insert(index, value.toString())
/**
* Inserts the string [value] into this string builder at the specified [index] and returns this instance.
@@ -432,7 +432,7 @@ actual class StringBuilder private constructor (
*
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
actual fun insert(index: Int, value: String?): StringBuilder {
public actual fun insert(index: Int, value: String?): StringBuilder {
val toInsert = value ?: "null"
AbstractList.checkPositionIndex(index, _length)
ensureExtraCapacity(toInsert.length)
@@ -452,7 +452,7 @@ actual class StringBuilder private constructor (
*
* @throws IndexOutOfBoundsException or [IllegalArgumentException] if [newLength] is less than zero.
*/
actual fun setLength(newLength: Int) {
public actual fun setLength(newLength: Int) {
if (newLength < 0) {
throw IllegalArgumentException("Negative new length: $newLength.")
}
@@ -469,7 +469,7 @@ actual class StringBuilder private constructor (
*
* @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this string builder indices or when `startIndex > endIndex`.
*/
actual fun substring(startIndex: Int, endIndex: Int): String {
public actual fun substring(startIndex: Int, endIndex: Int): String {
AbstractList.checkBoundsIndexes(startIndex, endIndex, _length)
return unsafeStringFromCharArray(array, startIndex, endIndex - startIndex)
}
@@ -480,7 +480,7 @@ actual class StringBuilder private constructor (
* @throws IndexOutOfBoundsException if [startIndex] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
actual fun substring(startIndex: Int): String {
public actual fun substring(startIndex: Int): String {
return substring(startIndex, _length)
}
@@ -491,7 +491,7 @@ actual class StringBuilder private constructor (
* then it may be resized to become more space efficient.
* Calling this method may, but is not required to, affect the value of the [capacity] property.
*/
actual fun trimToSize() {
public actual fun trimToSize() {
if (_length < array.size)
array = array.copyOf(_length)
}
@@ -503,7 +503,7 @@ actual class StringBuilder private constructor (
*
* @throws IndexOutOfBoundsException if [index] is out of bounds of this string builder.
*/
operator fun set(index: Int, value: Char) {
public operator fun set(index: Int, value: Char) {
AbstractList.checkElementIndex(index, _length)
array[index] = value
}
@@ -518,7 +518,7 @@ actual class StringBuilder private constructor (
* @throws IndexOutOfBoundsException or [IllegalArgumentException] if [startIndex] is less than zero, greater than the length of this string builder, or `startIndex > endIndex`.
*/
@SinceKotlin("1.4")
fun setRange(startIndex: Int, endIndex: Int, value: String): StringBuilder {
public fun setRange(startIndex: Int, endIndex: Int, value: String): StringBuilder {
checkReplaceRange(startIndex, endIndex, _length)
val coercedEndIndex = endIndex.coerceAtMost(_length)
@@ -542,7 +542,7 @@ actual class StringBuilder private constructor (
* @throws IndexOutOfBoundsException if [index] is out of bounds of this string builder.
*/
@SinceKotlin("1.4")
fun deleteAt(index: Int): StringBuilder {
public fun deleteAt(index: Int): StringBuilder {
AbstractList.checkElementIndex(index, _length)
array.copyInto(array, startIndex = index + 1, endIndex = _length, destinationOffset = index)
--_length
@@ -558,7 +558,7 @@ actual class StringBuilder private constructor (
* @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] is out of range of this string builder indices or when `startIndex > endIndex`.
*/
@SinceKotlin("1.4")
fun deleteRange(startIndex: Int, endIndex: Int): StringBuilder {
public fun deleteRange(startIndex: Int, endIndex: Int): StringBuilder {
checkReplaceRange(startIndex, endIndex, _length)
val coercedEndIndex = endIndex.coerceAtMost(_length)
@@ -580,7 +580,7 @@ actual class StringBuilder private constructor (
* or when that index is out of the [destination] array indices range.
*/
@SinceKotlin("1.4")
fun toCharArray(destination: CharArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = this.length) {
public fun toCharArray(destination: CharArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = this.length) {
AbstractList.checkBoundsIndexes(startIndex, endIndex, _length)
AbstractList.checkBoundsIndexes(destinationOffset, destinationOffset + endIndex - startIndex, destination.size)
@@ -599,7 +599,7 @@ actual class StringBuilder private constructor (
* @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of the [value] array indices or when `startIndex > endIndex`.
*/
@SinceKotlin("1.4")
fun appendRange(value: CharArray, startIndex: Int, endIndex: Int): StringBuilder {
public fun appendRange(value: CharArray, startIndex: Int, endIndex: Int): StringBuilder {
AbstractList.checkBoundsIndexes(startIndex, endIndex, value.size)
val extraLength = endIndex - startIndex
ensureExtraCapacity(extraLength)
@@ -618,7 +618,7 @@ actual class StringBuilder private constructor (
* @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of the [value] character sequence indices or when `startIndex > endIndex`.
*/
@SinceKotlin("1.4")
fun appendRange(value: CharSequence, startIndex: Int, endIndex: Int): StringBuilder {
public fun appendRange(value: CharSequence, startIndex: Int, endIndex: Int): StringBuilder {
AbstractList.checkBoundsIndexes(startIndex, endIndex, value.length)
val extraLength = endIndex - startIndex
ensureExtraCapacity(extraLength)
@@ -646,7 +646,7 @@ actual class StringBuilder private constructor (
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
fun insertRange(index: Int, value: CharSequence, startIndex: Int, endIndex: Int): StringBuilder {
public fun insertRange(index: Int, value: CharSequence, startIndex: Int, endIndex: Int): StringBuilder {
AbstractList.checkBoundsIndexes(startIndex, endIndex, value.length)
AbstractList.checkPositionIndex(index, _length)
val extraLength = endIndex - startIndex
@@ -677,7 +677,7 @@ actual class StringBuilder private constructor (
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
fun insertRange(index: Int, value: CharArray, startIndex: Int, endIndex: Int): StringBuilder {
public fun insertRange(index: Int, value: CharArray, startIndex: Int, endIndex: Int): StringBuilder {
AbstractList.checkPositionIndex(index, _length)
AbstractList.checkBoundsIndexes(startIndex, endIndex, value.size)
@@ -788,7 +788,7 @@ public actual inline fun StringBuilder.deleteRange(startIndex: Int, endIndex: In
@SinceKotlin("1.4")
@Suppress("EXTENSION_SHADOWED_BY_MEMBER", "ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
@kotlin.internal.InlineOnly
public actual inline fun StringBuilder.toCharArray(destination: CharArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = this.length) =
public actual inline fun StringBuilder.toCharArray(destination: CharArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = this.length): Unit =
this.toCharArray(destination, destinationOffset, startIndex, endIndex)
/**
@@ -892,7 +892,7 @@ public inline fun StringBuilder.insert(index: Int, csq: CharSequence?, start: In
@DeprecatedSinceKotlin(warningSince = "1.3", errorSince = "1.6")
@Deprecated("Use set(index: Int, value: Char) instead", ReplaceWith("set(index, value)"))
@kotlin.internal.InlineOnly
public inline fun StringBuilder.setCharAt(index: Int, value: Char) = this.set(index, value)
public inline fun StringBuilder.setCharAt(index: Int, value: Char): Unit = this.set(index, value)
/**
* Removes the character at the specified [index] from this string builder and returns this instance.
@@ -906,4 +906,4 @@ public inline fun StringBuilder.setCharAt(index: Int, value: Char) = this.set(in
@DeprecatedSinceKotlin(warningSince = "1.4", errorSince = "1.6")
@Deprecated("Use deleteAt(index: Int) instead", ReplaceWith("deleteAt(index)"))
@kotlin.internal.InlineOnly
public inline fun StringBuilder.deleteCharAt(index: Int) = this.deleteAt(index)
public inline fun StringBuilder.deleteCharAt(index: Int): StringBuilder = this.deleteAt(index)
@@ -16,20 +16,20 @@ import kotlin.contracts.*
*
* String builder can be used to efficiently perform multiple string manipulation operations.
*/
expect class StringBuilder : Appendable, CharSequence {
public expect class StringBuilder : Appendable, CharSequence {
/** Constructs an empty string builder. */
constructor()
public constructor()
/** Constructs an empty string builder with the specified initial [capacity]. */
constructor(capacity: Int)
public constructor(capacity: Int)
/** Constructs a string builder that contains the same characters as the specified [content] char sequence. */
constructor(content: CharSequence)
public constructor(content: CharSequence)
/** Constructs a string builder that contains the same characters as the specified [content] string. */
@SinceKotlin("1.3")
// @ExperimentalStdlibApi
constructor(content: String)
public constructor(content: String)
override val length: Int
@@ -50,7 +50,7 @@ expect class StringBuilder : Appendable, CharSequence {
* Note that the reverse operation may produce new surrogate pairs that were unpaired low-surrogates and high-surrogates before the operation.
* For example, reversing `"\uDC00\uD800"` produces `"\uD800\uDC00"` which is a valid surrogate pair.
*/
fun reverse(): StringBuilder
public fun reverse(): StringBuilder
/**
* Appends the string representation of the specified object [value] to this string builder and returns this instance.
@@ -58,7 +58,7 @@ expect class StringBuilder : Appendable, CharSequence {
* The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
* and then that string was appended to this string builder.
*/
fun append(value: Any?): StringBuilder
public fun append(value: Any?): StringBuilder
/**
* Appends the string representation of the specified boolean [value] to this string builder and returns this instance.
@@ -67,7 +67,7 @@ expect class StringBuilder : Appendable, CharSequence {
* and then that string was appended to this string builder.
*/
@SinceKotlin("1.3")
fun append(value: Boolean): StringBuilder
public fun append(value: Boolean): StringBuilder
/**
* Appends the string representation of the specified byte [value] to this string builder and returns this instance.
@@ -76,7 +76,7 @@ expect class StringBuilder : Appendable, CharSequence {
* and then that string was appended to this string builder.
*/
@SinceKotlin("1.9")
fun append(value: Byte): StringBuilder
public fun append(value: Byte): StringBuilder
/**
* Appends the string representation of the specified short [value] to this string builder and returns this instance.
@@ -85,7 +85,7 @@ expect class StringBuilder : Appendable, CharSequence {
* and then that string was appended to this string builder.
*/
@SinceKotlin("1.9")
fun append(value: Short): StringBuilder
public fun append(value: Short): StringBuilder
/**
* Appends the string representation of the specified int [value] to this string builder and returns this instance.
@@ -94,7 +94,7 @@ expect class StringBuilder : Appendable, CharSequence {
* and then that string was appended to this string builder.
*/
@SinceKotlin("1.9")
fun append(value: Int): StringBuilder
public fun append(value: Int): StringBuilder
/**
* Appends the string representation of the specified long [value] to this string builder and returns this instance.
@@ -103,7 +103,7 @@ expect class StringBuilder : Appendable, CharSequence {
* and then that string was appended to this string builder.
*/
@SinceKotlin("1.9")
fun append(value: Long): StringBuilder
public fun append(value: Long): StringBuilder
/**
* Appends the string representation of the specified float [value] to this string builder and returns this instance.
@@ -112,7 +112,7 @@ expect class StringBuilder : Appendable, CharSequence {
* and then that string was appended to this string builder.
*/
@SinceKotlin("1.9")
fun append(value: Float): StringBuilder
public fun append(value: Float): StringBuilder
/**
* Appends the string representation of the specified double [value] to this string builder and returns this instance.
@@ -121,7 +121,7 @@ expect class StringBuilder : Appendable, CharSequence {
* and then that string was appended to this string builder.
*/
@SinceKotlin("1.9")
fun append(value: Double): StringBuilder
public fun append(value: Double): StringBuilder
/**
* Appends characters in the specified character array [value] to this string builder and returns this instance.
@@ -129,7 +129,7 @@ expect class StringBuilder : Appendable, CharSequence {
* Characters are appended in order, starting at the index 0.
*/
@SinceKotlin("1.4")
fun append(value: CharArray): StringBuilder
public fun append(value: CharArray): StringBuilder
/**
* Appends the specified string [value] to this string builder and returns this instance.
@@ -137,7 +137,7 @@ expect class StringBuilder : Appendable, CharSequence {
* If [value] is `null`, then the four characters `"null"` are appended.
*/
@SinceKotlin("1.3")
fun append(value: String?): StringBuilder
public fun append(value: String?): StringBuilder
/**
* Returns the current capacity of this string builder.
@@ -147,7 +147,7 @@ expect class StringBuilder : Appendable, CharSequence {
* In Kotlin/JS implementation of StringBuilder the value returned from this method may not indicate the actual size of the backing storage.
*/
@SinceKotlin("1.3")
fun capacity(): Int
public fun capacity(): Int
/**
* Ensures that the capacity of this string builder is at least equal to the specified [minimumCapacity].
@@ -156,7 +156,7 @@ expect class StringBuilder : Appendable, CharSequence {
* Otherwise, this method takes no action and simply returns.
*/
@SinceKotlin("1.4")
fun ensureCapacity(minimumCapacity: Int)
public fun ensureCapacity(minimumCapacity: Int)
/**
* Returns the index within this string builder of the first occurrence of the specified [string].
@@ -164,7 +164,7 @@ expect class StringBuilder : Appendable, CharSequence {
* Returns `-1` if the specified [string] does not occur in this string builder.
*/
@SinceKotlin("1.4")
fun indexOf(string: String): Int
public fun indexOf(string: String): Int
/**
* Returns the index within this string builder of the first occurrence of the specified [string],
@@ -173,7 +173,7 @@ expect class StringBuilder : Appendable, CharSequence {
* Returns `-1` if the specified [string] does not occur in this string builder starting at the specified [startIndex].
*/
@SinceKotlin("1.4")
fun indexOf(string: String, startIndex: Int): Int
public fun indexOf(string: String, startIndex: Int): Int
/**
* Returns the index within this string builder of the last occurrence of the specified [string].
@@ -182,7 +182,7 @@ expect class StringBuilder : Appendable, CharSequence {
* Returns `-1` if the specified [string] does not occur in this string builder.
*/
@SinceKotlin("1.4")
fun lastIndexOf(string: String): Int
public fun lastIndexOf(string: String): Int
/**
* Returns the index within this string builder of the last occurrence of the specified [string],
@@ -191,7 +191,7 @@ expect class StringBuilder : Appendable, CharSequence {
* Returns `-1` if the specified [string] does not occur in this string builder starting at the specified [startIndex].
*/
@SinceKotlin("1.4")
fun lastIndexOf(string: String, startIndex: Int): Int
public fun lastIndexOf(string: String, startIndex: Int): Int
/**
* Inserts the string representation of the specified boolean [value] into this string builder at the specified [index] and returns this instance.
@@ -202,7 +202,7 @@ expect class StringBuilder : Appendable, CharSequence {
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
fun insert(index: Int, value: Boolean): StringBuilder
public fun insert(index: Int, value: Boolean): StringBuilder
/**
* Inserts the string representation of the specified byte [value] into this string builder at the specified [index] and returns this instance.
@@ -213,7 +213,7 @@ expect class StringBuilder : Appendable, CharSequence {
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.9")
fun insert(index: Int, value: Byte): StringBuilder
public fun insert(index: Int, value: Byte): StringBuilder
/**
* Inserts the string representation of the specified short [value] into this string builder at the specified [index] and returns this instance.
@@ -224,7 +224,7 @@ expect class StringBuilder : Appendable, CharSequence {
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.9")
fun insert(index: Int, value: Short): StringBuilder
public fun insert(index: Int, value: Short): StringBuilder
/**
* Inserts the string representation of the specified int [value] into this string builder at the specified [index] and returns this instance.
@@ -235,7 +235,7 @@ expect class StringBuilder : Appendable, CharSequence {
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.9")
fun insert(index: Int, value: Int): StringBuilder
public fun insert(index: Int, value: Int): StringBuilder
/**
* Inserts the string representation of the specified long [value] into this string builder at the specified [index] and returns this instance.
@@ -246,7 +246,7 @@ expect class StringBuilder : Appendable, CharSequence {
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.9")
fun insert(index: Int, value: Long): StringBuilder
public fun insert(index: Int, value: Long): StringBuilder
/**
* Inserts the string representation of the specified float [value] into this string builder at the specified [index] and returns this instance.
@@ -257,7 +257,7 @@ expect class StringBuilder : Appendable, CharSequence {
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.9")
fun insert(index: Int, value: Float): StringBuilder
public fun insert(index: Int, value: Float): StringBuilder
/**
* Inserts the string representation of the specified double [value] into this string builder at the specified [index] and returns this instance.
@@ -268,7 +268,7 @@ expect class StringBuilder : Appendable, CharSequence {
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.9")
fun insert(index: Int, value: Double): StringBuilder
public fun insert(index: Int, value: Double): StringBuilder
/**
* Inserts the specified character [value] into this string builder at the specified [index] and returns this instance.
@@ -276,7 +276,7 @@ expect class StringBuilder : Appendable, CharSequence {
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
fun insert(index: Int, value: Char): StringBuilder
public fun insert(index: Int, value: Char): StringBuilder
/**
* Inserts characters in the specified character array [value] into this string builder at the specified [index] and returns this instance.
@@ -286,7 +286,7 @@ expect class StringBuilder : Appendable, CharSequence {
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
fun insert(index: Int, value: CharArray): StringBuilder
public fun insert(index: Int, value: CharArray): StringBuilder
/**
* Inserts characters in the specified character sequence [value] into this string builder at the specified [index] and returns this instance.
@@ -299,7 +299,7 @@ expect class StringBuilder : Appendable, CharSequence {
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
fun insert(index: Int, value: CharSequence?): StringBuilder
public fun insert(index: Int, value: CharSequence?): StringBuilder
/**
* Inserts the string representation of the specified object [value] into this string builder at the specified [index] and returns this instance.
@@ -310,7 +310,7 @@ expect class StringBuilder : Appendable, CharSequence {
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
fun insert(index: Int, value: Any?): StringBuilder
public fun insert(index: Int, value: Any?): StringBuilder
/**
* Inserts the string [value] into this string builder at the specified [index] and returns this instance.
@@ -320,7 +320,7 @@ expect class StringBuilder : Appendable, CharSequence {
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
fun insert(index: Int, value: String?): StringBuilder
public fun insert(index: Int, value: String?): StringBuilder
/**
* Sets the length of this string builder to the specified [newLength].
@@ -334,7 +334,7 @@ expect class StringBuilder : Appendable, CharSequence {
* @throws IndexOutOfBoundsException or [IllegalArgumentException] if [newLength] is less than zero.
*/
@SinceKotlin("1.4")
fun setLength(newLength: Int)
public fun setLength(newLength: Int)
/**
* Returns a new [String] that contains characters in this string builder at [startIndex] (inclusive) and up to the [length] (exclusive).
@@ -342,7 +342,7 @@ expect class StringBuilder : Appendable, CharSequence {
* @throws IndexOutOfBoundsException if [startIndex] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
fun substring(startIndex: Int): String
public fun substring(startIndex: Int): String
/**
* Returns a new [String] that contains characters in this string builder at [startIndex] (inclusive) and up to the [endIndex] (exclusive).
@@ -350,7 +350,7 @@ expect class StringBuilder : Appendable, CharSequence {
* @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this string builder indices or when `startIndex > endIndex`.
*/
@SinceKotlin("1.4")
fun substring(startIndex: Int, endIndex: Int): String
public fun substring(startIndex: Int, endIndex: Int): String
/**
* Attempts to reduce storage used for this string builder.
@@ -360,7 +360,7 @@ expect class StringBuilder : Appendable, CharSequence {
* Calling this method may, but is not required to, affect the value of the [capacity] property.
*/
@SinceKotlin("1.4")
fun trimToSize()
public fun trimToSize()
}