I have a long String which I want to shorten step by step. The String contains a lot of characters which I don't need, but the String has some patterns, so I search for a character, shorten the original String or rather the copy of the original String and search for the next relevant character.
Code Block let searchname = "" let f = globalString.firstIndex(of: "\"") self.globalString.dropFirst(f) let e = globalString.firstIndex(of: "\\") let substring = globalString[...e!] return String(substring)
In line three I get the error, that an Integer is needed and a String.index is given. How can I transform the String.index to an Integer or is there another possibility to this in code?