I'm having a problem getting the substring of a string which includes two double-quotes "
.
For example: my desString is equal to ["39013"]
I need to get: 39013
But the problem is when I'm looking for the index of "
signs, Swift sees that as a normal code, not as a specific character. How can I fix this?
This is not duplicate, in this question he is asking '
sign, but I am asking about "
which is similar sign when you are printing a specific value (for example: print("dup"). This means, when I am trying to find the index of "
char with index(of """)
there are three of them and Xcode says one of them is missing. Actually it's not missing, I am looking for it. But THAT'S THE PROBLEM.
Here is my code to find the indexes with "["
and "]"
.
let first = desString.index(of: "[") ?? desString.startIndex
let last = desString.index(of: " ") ?? desString.endIndex
let substring1 = desenString[first..<last]