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

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

Comments