Hi! I’d like to ask whether `CharSequence.rangesDe...
# stdlib
s
Hi! I’d like to ask whether
CharSequence.rangesDelimitedBy
in
Strings.kt
could be made public, and if so, what the right process would be. Reason: I want to split a string by a delimiter and take the n-th element efficiently. Using
splitToSequence().drop(n)
still creates all dropped substrings. Internally this goes through
rangesDelimitedBy(params).map { substring(it) }
, so having access to
rangesDelimitedBy
would allow dropping before substring creation and avoid unnecessary allocations. The API seems low-risk since it’s already well-documented and its parameters match existing public
split
/
splitToSequence
functions. Note: I think Sequence<IntRange> feels so nice for splitting!