String is an important exception, because Unicode makes things complicated.
String.subscript(i: Index)is not guaranteed to be a constant-time operation, because it sometimes needs to find the end of a grapheme cluster.- Similarly,
String.first/String.lastare examples ofO(n)properties.