Skip to content

Commit 3bb8cf1

Browse files
committed
Temporary restore CharSequence.get extension
1 parent a76a8fc commit 3bb8cf1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

libraries/stdlib/src/kotlin/text/Strings.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,15 @@ public val String.indices: IntRange
191191
public val String.lastIndex: Int
192192
get() = this.length() - 1
193193

194+
/**
195+
* Returns a character at the given index in a [CharSequence]. Allows to use the
196+
* index operator for working with character sequences:
197+
* ```
198+
* val c = charSequence[5]
199+
* ```
200+
*/
201+
public operator fun CharSequence.get(index: Int): Char = this.get(index)
202+
194203
/**
195204
* Returns `true` if this CharSequence has Unicode surrogate pair at the specified [index].
196205
*/

0 commit comments

Comments
 (0)