From 3bb8cf1bff383585168d44d8573d0f8e34a8940c Mon Sep 17 00:00:00 2001 From: Denis Zharkov Date: Sun, 11 Oct 2015 15:35:24 +0300 Subject: [PATCH] Temporary restore CharSequence.get extension --- libraries/stdlib/src/kotlin/text/Strings.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libraries/stdlib/src/kotlin/text/Strings.kt b/libraries/stdlib/src/kotlin/text/Strings.kt index cfe44983ace..398f227c831 100644 --- a/libraries/stdlib/src/kotlin/text/Strings.kt +++ b/libraries/stdlib/src/kotlin/text/Strings.kt @@ -191,6 +191,15 @@ public val String.indices: IntRange public val String.lastIndex: Int get() = this.length() - 1 +/** + * Returns a character at the given index in a [CharSequence]. Allows to use the + * index operator for working with character sequences: + * ``` + * val c = charSequence[5] + * ``` + */ +public operator fun CharSequence.get(index: Int): Char = this.get(index) + /** * Returns `true` if this CharSequence has Unicode surrogate pair at the specified [index]. */