https://github.com/jwerle/strsplit.c
Split a string into a char array by a given delimiter
https://github.com/jwerle/strsplit.c
Last synced: about 1 year ago
JSON representation
Split a string into a char array by a given delimiter
- Host: GitHub
- URL: https://github.com/jwerle/strsplit.c
- Owner: jwerle
- License: mit
- Created: 2013-10-17T14:31:37.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2016-04-01T17:49:22.000Z (about 10 years ago)
- Last Synced: 2025-03-29T19:34:27.466Z (about 1 year ago)
- Language: C
- Size: 15.6 KB
- Stars: 14
- Watchers: 4
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: History.md
- License: LICENSE
Awesome Lists containing this project
README
strsplit.c
==========
Split a string into a char array by a given delimiter
## install
```sh
$ clib install jwerle/strsplit.c
```
## usage
```c
size_t size = strsplit(char *str, char **parts, char *delimiter);
```
## example
```c
#include "strsplit.h"
int
main (void) {
char str[] = "hello\nworld";
char *parts[2];
size_t size = strsplit(str, parts, "\n");
int i = 0;
for (; i < size; ++i) {
printf("%s\n", parts[i]);
}
return 0;
}
```
## license
MIT