String replacement of character at

I think that's definitely one of the main reasons, if not the reason. This discussion comes up every now and then, so I think it would be good for you to read through some existing posts which go into much more detail:

https://forums.swift.org/t/why-are-string-offsets-so-complicated/
https://forums.swift.org/t/how-to-make-string-index-with-int-offset-distance-in-o-1-time

2 Likes