There is an index called endIndex in a string which is the index after a last element of a string. So, I can iterate through a string from start like this:
But I want to iterate from the end. Is there an elegant way to do it? Thanks in advance!
Code Block Swift var index = s.startIndex while index != s.endIndex { index = s.index(after: index) }
But I want to iterate from the end. Is there an elegant way to do it? Thanks in advance!