@arroz @Catfish_Man Honestly, I had never thought of:
.split(whereSeparator: \.isNewline)
I'd gone round rubin's barn with Data and `UInt8(ascii: "\n")`, but `.isNewLine` is so much simpler. Thank you.
Top-level
@arroz @Catfish_Man Honestly, I had never thought of: .split(whereSeparator: \.isNewline) I'd gone round rubin's barn with Data and `UInt8(ascii: "\n")`, but `.isNewLine` is so much simpler. Thank you. 2 comments
@cocoaphony @arroz if you want the *really* neat version (…tooting my own horn here), check out url.resourceBytes.lines 😃 |
@cocoaphony And for a case where you really want to split purely on the \n:
"a\r\nb".unicodeScalars.split(separator: "\n").map { Substring($0) }