The below example reads lines from a file buffer.
I want to split the lines into an array which will later be converted to a Table
struct.
When I print the String is looks similar to this:
let string_line: String = line.unwrap()
println!("{}", string_line);
Tom,Stuart,1,23.0
However after splitting it, it is converted to another type/struct and I don't know how to convert it to an array.
let string_line = line.unwrap();
let split_line = string_line.split(",");
println!("{:?}", split_line);
Split(SplitInternal { start: 0, end: 72, matcher: StrSearcher { haystack: "Tom,Stuart,1,23.0", needle: ",", searcher: TwoWay(TwoWaySearcher { crit_pos: 0, crit_pos_back: 1, period: 1, byteset: 17592186044416, position: 0, end: 72, memory: 0, memory_back: 1 }) }, allow_trailing_empty: true, finished: false })
How to convert a String
to an array so that it can be converted to a Table
struct later?