C function that sorts words within a string.
Written in:
- c
Takes in a space separated string of words with a buffer and a flag value; sorts the words in the string into the provided buffer in lexical order. The buffer is truncated to a single delimiter if the string consists of only spaces.
char* src: string containing words to sort. char* dst: destination buffer to store sorted words. unsigned int dst_len: length of the destination buffer. unsigned int flags: flag to alter sorting behavior
WORD_SORT_REVERSE 0x1 WORD_SORT_IGNORE_CASE 0x2
Returns the number of characters written into the buffer including the terminator if successful or 0 otherwise.
run make test
in the project directory