string.components.seperatedBy

Next question, is either of

let rows = data.components(separatedBy: “\n”)

or

let columns = row.componentsSeparated(by: “;”)

supposed to be implemented as both fail when running Silver under Visual Studio

should be, but iirc Apple has renamed this like 35 times over the past few years. I’ll check in the morning.

You can also always see (and contribute to) the full source, at https://github.com/remobjects/SwiftBaseLibrary

It looks like it should be there however this code

 private func csv(data: String) -> [[String]] {
    var result: [[String]] = []
    let rows = data.components(separatedBy: "\n")
    for row in rows {
        let columns = row.components(separatedBy: ";")
        result.append(columns)
    }
    return result
}

gives the error

(E44) No member “components separatedBy” on type “String!”

Oops, looks like the func is missing public. fixed.

When will this be reflected in the downloads?

it’s on GitHub now, and will be in coming Friday’s new build.

1 Like