table of contents
| PMIX_ARGV_SPLIT(3) | OpenPMIx | PMIX_ARGV_SPLIT(3) |
PMIx_Argv_split — Split a string on a delimiter into a NULL-terminated argv-style array, discarding empty tokens.
SYNOPSIS¶
#include <pmix.h> char **PMIx_Argv_split(const char *src_string, int delimiter);
Python Syntax¶
No Python equivalent
INPUT PARAMETERS¶
- src_string: The string to tokenize. May be NULL or empty.
- delimiter: The character on which to split, passed as an int.
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) <#man3-pmix-argv-split-with-empty>. Both routines are thin wrappers over PMIx_Argv_split_inter(3) <#man3-pmix-argv-split-inter>; 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) <#man3-pmix-argv-free>.
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) <#man3-pmix-argv-count> of zero). NULL is also returned if an internal allocation fails.
EXAMPLES¶
char **argv = PMIx_Argv_split("a::b:", ':');
/* argv == { "a", "b", NULL } -- empty tokens dropped */
PMIx_Argv_free(argv);
See also:
Copyright¶
2014-2026, OpenPMIx Community
| November 5, 2026 |