How do I get the string before a certain character in swift? The code below is how I did it in Objective C, but can\'t seem to perform the same task in Swift. Any tips or su
Following up on Syed Tariq's answer: If you only want the string before the delimiter (otherwise, you receive an array [String]):
var token = newstr.components(separatedBy: delimiter).first