Subscripting in String extension to access substrings and characters with Int types

The reason that String doesn’t allow this today is that subscripting is expected to be a constant-time operation (and, in Collection, this is made explicit). The variable-width nature of Characters makes this infeasible for string without sacrificing efficiency in other areas.

1 Like