https://github.com/foxcapades/d-dsv
Toy delimiter separated values parser in D
https://github.com/foxcapades/d-dsv
Last synced: 6 months ago
JSON representation
Toy delimiter separated values parser in D
- Host: GitHub
- URL: https://github.com/foxcapades/d-dsv
- Owner: Foxcapades
- License: mit
- Created: 2018-03-24T19:48:14.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-21T13:18:24.000Z (over 8 years ago)
- Last Synced: 2025-04-06T11:48:42.082Z (over 1 year ago)
- Language: D
- Size: 22.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# D-DSV
Toy implementation of a simplistic csv/tsv/*sv separated value parser library in
D. Made for the purpose of getting familiar with D as a language.
## Usage
### Sample Input
_test.tsv_
```csv
"hello" goodbye
"line
""breaks"""
foo bar
"fizz"
```
_test.d_
```d
import std.stdio;
import dsv;
void main(string[] args) {
char[5] buffer;
HeadlessParser tsv = new HeadlessParser('\t', '"', 100);
char[] tmp;
do {
tmp = stdin.rawRead(buffer);
tsv.write(tmp);
} while (tmp.length == buffer.length);
writeln(tsv.read);
}
```
```bash
$ cat test.csv | dub run
[["hello", "goodbye"], ["line\n\t\"breaks\"", ""], ["foo", "bar"], ["", "fizz"]]
```
### TODO
* Handle headers