18.2.227. PMIx_Argv_split
PMIx_Argv_split — Split a string on a delimiter into a
NULL-terminated argv-style array, discarding empty tokens.
18.2.227.1. SYNOPSIS
#include <pmix.h>
char **PMIx_Argv_split(const char *src_string, int delimiter);
18.2.227.1.1. Python Syntax
No Python equivalent
18.2.227.2. INPUT PARAMETERS
src_string: The string to tokenize. May beNULLor empty.delimiter: The character on which to split, passed as anint.
18.2.227.3. DESCRIPTION
Break src_string into tokens separated by delimiter and return the
tokens as a freshly allocated, NULL-terminated argv-style array. Each
token is an independently allocated copy of the corresponding substring.
Zero-length tokens are discarded: runs of consecutive delimiters, and any
leading or trailing delimiter, produce no empty entries in the result. To
retain empty tokens instead, use
PMIx_Argv_split_with_empty(3). Both
routines are thin wrappers over
PMIx_Argv_split_inter(3); this one passes
include_empty = false.
The returned array and all of its strings are owned by the caller and must be released with PMIx_Argv_free(3).
18.2.227.4. RETURN VALUE
Returns a newly allocated NULL-terminated array of token strings. If
src_string is NULL or contains no non-empty tokens, the returned
pointer is NULL (an PMIx_Argv_count(3) of
zero). NULL is also returned if an internal allocation fails.
18.2.227.5. EXAMPLES
char **argv = PMIx_Argv_split("a::b:", ':');
/* argv == { "a", "b", NULL } -- empty tokens dropped */
PMIx_Argv_free(argv);