https://github.com/guitarbum722/libqualified
Like strsep, but considers quoted tokens in delimited data.
https://github.com/guitarbum722/libqualified
c csv delimited-data delimited-files quotes text-processing
Last synced: about 1 month ago
JSON representation
Like strsep, but considers quoted tokens in delimited data.
- Host: GitHub
- URL: https://github.com/guitarbum722/libqualified
- Owner: Guitarbum722
- Created: 2019-02-03T02:40:38.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-02-07T16:51:02.000Z (over 5 years ago)
- Last Synced: 2025-01-14T05:10:04.753Z (over 1 year ago)
- Topics: c, csv, delimited-data, delimited-files, quotes, text-processing
- Language: C++
- Homepage:
- Size: 28.3 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# libqualified
It's basically `strsep` from ``, but allows for quoted fields.
This is useful if the input's delimiter characters is actually part of the data in one or more of the tokens (eg. a comma delimited field in a CSV such as "Moby, M.D.").
### Sample usage
```c
#include
#include "qual.h"
int
main()
{
char *field, *input, *tofree;
tofree = input = strdup("Don|K|\"Moby, M.D.\"|don.moby@nothing.com");
while ((field = strqsep(&input, "|", "\"")) != NULL) {
printf("%s\n", field);
}
free(tofree);
return 0;
}
```
Output:
```
Don
K
"Moby, M.D."
don.moby@nothing.com
```