mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 22:58:46 +00:00
Fix incorrect CSV reader settings for example, fix typo in docs
This commit is contained in:
@@ -63,8 +63,6 @@ Example:
|
|||||||
read_csv_from_string :: proc(filename: string) {
|
read_csv_from_string :: proc(filename: string) {
|
||||||
r: csv.Reader
|
r: csv.Reader
|
||||||
r.trim_leading_space = true
|
r.trim_leading_space = true
|
||||||
r.reuse_record = true // Without it you have to delete(record)
|
|
||||||
r.reuse_record_buffer = true // Without it you have to each of the fields within it
|
|
||||||
defer csv.reader_destroy(&r)
|
defer csv.reader_destroy(&r)
|
||||||
|
|
||||||
csv_data, ok := os.read_entire_file(filename)
|
csv_data, ok := os.read_entire_file(filename)
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ reader_destroy :: proc(r: ^Reader) {
|
|||||||
for record, row_idx in csv.iterator_next(&r) { ... }
|
for record, row_idx in csv.iterator_next(&r) { ... }
|
||||||
|
|
||||||
TIP: If you process the results within the loop and don't need to own the results,
|
TIP: If you process the results within the loop and don't need to own the results,
|
||||||
you can set the Reader's `reuse_record` and `reuse_record_reuse_record_buffer` to true;
|
you can set the Reader's `reuse_record` and `reuse_record_buffer` to true;
|
||||||
you won't need to delete the record or its fields.
|
you won't need to delete the record or its fields.
|
||||||
*/
|
*/
|
||||||
iterator_next :: proc(r: ^Reader) -> (record: []string, idx: int, err: Error, more: bool) {
|
iterator_next :: proc(r: ^Reader) -> (record: []string, idx: int, err: Error, more: bool) {
|
||||||
|
|||||||
Reference in New Issue
Block a user