Skip to content

jwerle/strsplit.c

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

strsplit.c

Split a string into a char array by a given delimiter

install

$ clib install jwerle/strsplit.c

usage

size_t size = strsplit(char *str, char **parts, char *delimiter);

example

#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

About

Split a string into a char array by a given delimiter

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •