If I have a string like follows:
"abc; expire=Thu, 16-Oct-2014 16:46:53 GMT; path=/;", and I am trying to extract everything between expire= and the next ; so I can get the timestamp, how would I do this in Swift? I am totally confused by the ideas of characters and StringIndex. I feel like the following code will give me the locations in the string of " expire=":
var range = cookie!.rangeOfString(" expires=");
I don't however understand where I should go from there.
In Java-like languages the algorithm would be something like:
1) Locate index of "expires=";
2) Take substring of everything after "expires=" to end of full string;
3) Look in substring for first occurrence of ";"
4) Everything from index 0 to index found in 3 is the expire timestamp.
How do you go about working with Swift strings?