JasPer  4.2.4
String Processing

String Processing. More...

Functions

JAS_EXPORT char * jas_strdup (const char *)
 Create a copy of a null-terminated string. More...
 
JAS_EXPORT char * jas_strtok (char *str, const char *delim, char **saveptr)
 Extract tokens from a string. More...
 
JAS_EXPORT int jas_stringtokenize (const char *string, const char *delim, char ***tokens_buf, size_t *max_tokens_buf, size_t *num_tokens_buf)
 Split a string into tokens based on specified delimiters. More...
 

Detailed Description

String Processing.

General information can be found here.

Function Documentation

◆ jas_strdup()

JAS_EXPORT char* jas_strdup ( const char *  s)

Create a copy of a null-terminated string.

This function has a behavior similar to the well-known strdup function.

◆ jas_stringtokenize()

JAS_EXPORT int jas_stringtokenize ( const char *  string,
const char *  delim,
char ***  tokens_buf,
size_t *  max_tokens_buf,
size_t *  num_tokens_buf 
)

Split a string into tokens based on specified delimiters.

Parameters
stringA pointer to a null-terminated string to be split into tokens.
delimA pointer to a null-terminated string contained characters used to delimit tokens.
tokens_bufA pointer to the output token array.
max_tokens_bufA pointer to the allocated size of the token array.
num_tokens_bufA pointer to the number of elements in the token array.

The memory to hold token information is allocated via jas_malloc() and friends.

Returns
If successful, zero is returned. Otherwise, a nonzero value is returned.

◆ jas_strtok()

JAS_EXPORT char* jas_strtok ( char *  str,
const char *  delim,
char **  saveptr 
)

Extract tokens from a string.

This function has a similar behavior as strtok_r in the POSIX standard.