Make consistent parameter nullability with appendLine
This commit is contained in:
@@ -116,10 +116,12 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
|
||||
|
||||
/**
|
||||
* Appends the specified string [value] to this string builder and returns this instance.
|
||||
*
|
||||
* If [value] is `null`, then the four characters `"null"` are appended.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
actual fun append(value: String): StringBuilder {
|
||||
this.string += value
|
||||
actual fun append(value: String?): StringBuilder {
|
||||
this.string += value ?: "null"
|
||||
return this
|
||||
}
|
||||
|
||||
@@ -280,14 +282,17 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
|
||||
/**
|
||||
* Inserts the string [value] into this string builder at the specified [index] and returns this instance.
|
||||
*
|
||||
* If [value] is `null`, then the four characters `"null"` are inserted.
|
||||
*
|
||||
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
actual fun insert(index: Int, value: String): StringBuilder {
|
||||
actual fun insert(index: Int, value: String?): StringBuilder {
|
||||
AbstractList.checkPositionIndex(index, length)
|
||||
|
||||
this.string = this.string.substring(0, index) + value + this.string.substring(index)
|
||||
val toInsert = value ?: "null"
|
||||
this.string = this.string.substring(0, index) + toInsert + this.string.substring(index)
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user