How to scan up to character in Swift

Issue #335

This is useful when we want to get the first meaningful line in a big paragraph

let scanner = Scanner(string: text)
var result: NSString? = ""
scanner.scanUpTo("\n", into: &result)
return result as String?
Written by

I’m open source contributor, writer, speaker and product maker.

Start the conversation