Provide Common StringBuilder.append/insert with primitive type arguments #KT-57359
Merge-request: KT-MR-10892 Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
This commit is contained in:
committed by
Space Team
parent
2d50bd6857
commit
fed453fdea
@@ -69,6 +69,60 @@ expect class StringBuilder : Appendable, CharSequence {
|
||||
@SinceKotlin("1.3")
|
||||
fun append(value: Boolean): StringBuilder
|
||||
|
||||
/**
|
||||
* Appends the string representation of the specified byte [value] to this string builder and returns this instance.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
fun append(value: Byte): StringBuilder
|
||||
|
||||
/**
|
||||
* Appends the string representation of the specified short [value] to this string builder and returns this instance.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
fun append(value: Short): StringBuilder
|
||||
|
||||
/**
|
||||
* Appends the string representation of the specified int [value] to this string builder and returns this instance.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
fun append(value: Int): StringBuilder
|
||||
|
||||
/**
|
||||
* Appends the string representation of the specified long [value] to this string builder and returns this instance.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
fun append(value: Long): StringBuilder
|
||||
|
||||
/**
|
||||
* Appends the string representation of the specified float [value] to this string builder and returns this instance.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
fun append(value: Float): StringBuilder
|
||||
|
||||
/**
|
||||
* Appends the string representation of the specified double [value] to this string builder and returns this instance.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
fun append(value: Double): StringBuilder
|
||||
|
||||
/**
|
||||
* Appends characters in the specified character array [value] to this string builder and returns this instance.
|
||||
*
|
||||
@@ -157,6 +211,72 @@ expect class StringBuilder : Appendable, CharSequence {
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
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.
|
||||
*
|
||||
* The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
|
||||
* and then that string was inserted into this string builder at the specified [index].
|
||||
*
|
||||
* @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
|
||||
|
||||
/**
|
||||
* Inserts the string representation of the specified short [value] into this string builder at the specified [index] and returns this instance.
|
||||
*
|
||||
* The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
|
||||
* and then that string was inserted into this string builder at the specified [index].
|
||||
*
|
||||
* @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
|
||||
|
||||
/**
|
||||
* Inserts the string representation of the specified int [value] into this string builder at the specified [index] and returns this instance.
|
||||
*
|
||||
* The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
|
||||
* and then that string was inserted into this string builder at the specified [index].
|
||||
*
|
||||
* @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
|
||||
|
||||
/**
|
||||
* Inserts the string representation of the specified long [value] into this string builder at the specified [index] and returns this instance.
|
||||
*
|
||||
* The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
|
||||
* and then that string was inserted into this string builder at the specified [index].
|
||||
*
|
||||
* @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
|
||||
|
||||
/**
|
||||
* Inserts the string representation of the specified float [value] into this string builder at the specified [index] and returns this instance.
|
||||
*
|
||||
* The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
|
||||
* and then that string was inserted into this string builder at the specified [index].
|
||||
*
|
||||
* @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
|
||||
|
||||
/**
|
||||
* Inserts the string representation of the specified double [value] into this string builder at the specified [index] and returns this instance.
|
||||
*
|
||||
* The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
|
||||
* and then that string was inserted into this string builder at the specified [index].
|
||||
*
|
||||
* @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
|
||||
|
||||
/**
|
||||
* Inserts the specified character [value] into this string builder at the specified [index] and returns this instance.
|
||||
*
|
||||
@@ -477,3 +597,27 @@ public inline fun StringBuilder.appendLine(value: Char): StringBuilder = append(
|
||||
@SinceKotlin("1.4")
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun StringBuilder.appendLine(value: Boolean): StringBuilder = append(value).appendLine()
|
||||
|
||||
/** Appends [value] to this [StringBuilder], followed by a line feed character (`\n`). */
|
||||
@SinceKotlin("1.9")
|
||||
public expect fun StringBuilder.appendLine(value: Byte): StringBuilder
|
||||
|
||||
/** Appends [value] to this [StringBuilder], followed by a line feed character (`\n`). */
|
||||
@SinceKotlin("1.9")
|
||||
public expect fun StringBuilder.appendLine(value: Short): StringBuilder
|
||||
|
||||
/** Appends [value] to this [StringBuilder], followed by a line feed character (`\n`). */
|
||||
@SinceKotlin("1.9")
|
||||
public expect fun StringBuilder.appendLine(value: Int): StringBuilder
|
||||
|
||||
/** Appends [value] to this [StringBuilder], followed by a line feed character (`\n`). */
|
||||
@SinceKotlin("1.9")
|
||||
public expect fun StringBuilder.appendLine(value: Long): StringBuilder
|
||||
|
||||
/** Appends [value] to this [StringBuilder], followed by a line feed character (`\n`). */
|
||||
@SinceKotlin("1.9")
|
||||
public expect fun StringBuilder.appendLine(value: Float): StringBuilder
|
||||
|
||||
/** Appends [value] to this [StringBuilder], followed by a line feed character (`\n`). */
|
||||
@SinceKotlin("1.9")
|
||||
public expect fun StringBuilder.appendLine(value: Double): StringBuilder
|
||||
Reference in New Issue
Block a user