4 ms·
That's the thing, there is no indexing model. Every string operation is an O(N) seek. But even if you don't care about performance, it's just cumbersome. Looki
by morshu9001 9mo ago
That's the thing, there is no indexing model. Every string operation is an O(N) seek. But even if you don't care about performance, it's just cumbersome.
Looking at the SO questions for simple things like finding the position of a substring, it also lacked a lot of typical built ins until Swift 5. But that was like 5 years after GA.
- saagarjha 9mo agoThere's definitely an indexing model, it's just that it's similar to that of a linked list. You can do all sorts of useful operations on a linked list. Not everything is O(n) in this world.
- morshu9001 9mo agoYou can't do any linked list operations on this other than "get next" which is still kinda different
- saagarjha 9mo agoMaybe it would be helpful if you have an example that you’re having trouble with.