src/lq-str.c
/**
 *  \brief Scans a C-String (char array) for the next delimeted token and null terminates it.
 * 
 *  \param source [in] - Original char array to scan.
 *  \param delimeter [in] - Character separating tokens (passed as integer value).
 *  \param tokenBuf [out] - Pointer to where token should be copied to.
 *  \param tokenBufSz [in] - Size of buffer to receive token.
 * 
 *  \return Pointer to the location in the source string immediately following the token.
*/
\brief Scans a C-String (char array) for the next delimeted token and null terminates it.

\param source [in] - Original char array to scan.
\param delimeter [in] - Character separating tokens (passed as integer value).
\param tokenBuf [out] - Pointer to where token should be copied to.
\param tokenBufSz [in] - Size of buffer to receive token.

\return Pointer to the location in the source string immediately following the token.
\ brief Scans a C - String ( char array ) for the next delimeted token and null terminates it . \ param source [ in ] - Original char array to scan . \ param delimeter [ in ] - Character separating tokens ( passed as integer value ) . \ param tokenBuf [ out ] - Pointer to where token should be copied to . \ param tokenBufSz [ in ] - Size of buffer to receive token . \ return Pointer to the location in the source string immediately following the token .
static char *lq_strGrabToken(char *source, int delimiter, char *tokenBuf, uint8_t tokenBufSz) 
{
    char *delimAt;
    if (source == NULL)
        return 0;
    delimAt = strchr(source, delimiter);
    uint8_t tokenSz = delimAt - source;
    if (tokenSz == 0)
        return NULL;
    memset(tokenBuf, 0, tokenBufSz);
    memcpy(tokenBuf, source, MIN(tokenSz, tokenBufSz-1));
    return delimAt + 1;
}
static char * lq_strGrabToken ( char * source , int delimiter , char * tokenBuf , uint8_t tokenBufSz ) { char * delimAt ; if ( source == NULL ) return 0 ; delimAt = strchr ( source , delimiter ) ; uint8_t tokenSz = delimAt - source ; if ( tokenSz == 0 ) return NULL ; memset ( tokenBuf , 0 , tokenBufSz ) ; memcpy ( tokenBuf , source , MIN ( tokenSz , tokenBufSz - 1 ) ) ; return delimAt + 1 ; }
\brief Scans a C-String (char array) for the next delimeted token and null terminates it.
\ brief Scans a C - String ( char array ) for the next delimeted token and null terminates it .