Skip to content
This repository has been archived by the owner on Aug 10, 2021. It is now read-only.

Common StringBuilder #3593

Merged
merged 1 commit into from
Dec 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion backend.native/tests/runtime/text/string_builder0.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ fun assertException(body: () -> Unit) {
try {
body()
throw AssertionError ("Test failed: no IndexOutOfBoundsException on wrong indices")
} catch (e: IndexOutOfBoundsException) {}
} catch (e: IndexOutOfBoundsException) {
} catch (e: IllegalArgumentException) {}
}

// Insert ===================================================================================================
Expand Down
25 changes: 25 additions & 0 deletions runtime/src/main/kotlin/kotlin/text/Appendable.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,33 @@

package kotlin.text

/**
* An object to which char sequences and values can be appended.
*/
public actual interface Appendable {
/**
* Appends the specified character [c] to this Appendable and returns this instance.
*
* @param c the character to append.
*/
actual fun append(c: Char): Appendable

/**
* Appends the specified character sequence [csq] to this Appendable and returns this instance.
*
* @param csq the character sequence to append. If [csq] is `null`, then the four characters `"null"` are appended to this Appendable.
*/
actual fun append(csq: CharSequence?): Appendable

/**
* Appends a subsequence of the specified character sequence [csq] to this Appendable and returns this instance.
*
* @param csq the character sequence from which a subsequence is appended. If [csq] is `null`,
* then characters are appended as if [csq] contained the four characters `"null"`.
* @param start the beginning (inclusive) of the subsequence to append.
* @param end the end (exclusive) of the subsequence to append.
*
* @throws IndexOutOfBoundsException or [IllegalArgumentException] when [start] or [end] is out of range of the [csq] character sequence indices or when `start > end`.
*/
actual fun append(csq: CharSequence?, start: Int, end: Int): Appendable
}
Loading