Introduce Common StringBuilder.append/insert(Byte/Short) extensions #KT-63341
This commit is contained in:
@@ -651,6 +651,50 @@ public actual class StringBuilder public actual constructor(content: String) : A
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@Suppress("EXTENSION_SHADOWED_BY_MEMBER", "NOTHING_TO_INLINE")
|
||||
@SinceKotlin("1.9")
|
||||
public actual inline fun StringBuilder.append(value: Byte): StringBuilder = this.append(value)
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@Suppress("EXTENSION_SHADOWED_BY_MEMBER", "NOTHING_TO_INLINE")
|
||||
@SinceKotlin("1.9")
|
||||
public actual inline fun StringBuilder.append(value: Short): StringBuilder = this.append(value)
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@Suppress("EXTENSION_SHADOWED_BY_MEMBER", "NOTHING_TO_INLINE")
|
||||
@SinceKotlin("1.9")
|
||||
public actual inline fun StringBuilder.insert(index: Int, value: Byte): StringBuilder = this.insert(index, value)
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@Suppress("EXTENSION_SHADOWED_BY_MEMBER", "NOTHING_TO_INLINE")
|
||||
@SinceKotlin("1.9")
|
||||
public actual inline fun StringBuilder.insert(index: Int, value: Short): StringBuilder = this.insert(index, value)
|
||||
|
||||
/**
|
||||
* Clears the content of this string builder making it empty and returns this instance.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user