In swift 4 you can use the following method to extract a substring:
let str = "abcdefghci"
let index = str.index(of: "c") ?? str.endIndex
print(str[...index])
This will print abc
But how can I find the index of the last c
, to extract a substring from that location ?
UPDATE
@vadian please see the attached image: