split2()

split2()#

split2() splits a string into a list of substrings using the specified delimiters, excluding empty substrings.

Prototype

const char **split2(
    const char *str,
    const char *delim,
    int *list_size
);

Parameters

Key

Type

Description

str

const char *

The input string to be split.

delim

const char *

A string containing delimiter characters used to split str.

list_size

int *

Pointer to an integer that will store the number of substrings found.


Return Value

A dynamically allocated array of strings containing the split substrings. The caller must free the array using split_free2(). Returns NULL on failure.

Notes

[‘Empty substrings are not included in the result.’, ‘The returned array is null-terminated.’, ‘Use split_free2() to free the allocated memory.’]

Prototype

// Not applicable in JS

Prototype

# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples