J. Dutch J. Dutch - 3 months ago 6x
Swift Question

How do I get a string between slashes -Swift

I have string like so


Which needs to be translated into an Array of strings so that if I printed the array it would look like this
print(arrayOfStrings) // prints ["blah","hahaha","lalala"]

I am new to swift so forgive me if this question is foolish



let text = "/blah//hahaha//lalala/"

you can

let chunks = String(text.characters.dropFirst().dropLast()).componentsSeparatedByString("//")

and this is what you get

["blah", "hahaha", "lalala"]