Re: String handling not working — am I going nuts?


On Apr 6, 2020, at 4:53 PM, Marco S Hyman <marc@...> wrote:

var str = try String(contentsOf: urlContext.url) // (1)
let lines = str.split(separator: “\r\n”) // (3)

works and is faster in that you’ve removed an O(n) operation,

You've also removed support for Unix line endings. Now it only supports Windows line endings; probably a bad idea.

On Apr 7, 2020, at 10:30 AM, Rick Aurbach via <rlaurb@...> wrote:

So I have a solution, but I don’t understand the original code didn’t work. Any insights?

I'm mystified too, but IMHO enumerateLines is a better way to do it.


Join to automatically receive all group messages.