src/lq-str.c
/**
 *  \brief Scans the source string for fromChr and replaces with toChr. Usefull for substitution of special char in query strings.
 * 
 *  \param [in\out] srcStr - Char pointer to the c-string containing required substitutions 
 *  \param [in] fromChr - Char value to replace in src 
 *  \param [in] toChr - Char value to put in place of fromChr 
 * 
 *  \return Number of substitutions made
*/
\brief Scans the source string for fromChr and replaces with toChr. Usefull for substitution of special char in query strings.

\param [in\out] srcStr - Char pointer to the c-string containing required substitutions
\param [in] fromChr - Char value to replace in src
\param [in] toChr - Char value to put in place of fromChr

\return Number of substitutions made
\ brief Scans the source string for fromChr and replaces with toChr . Usefull for substitution of special char in query strings . \ param [ in \ out ] srcStr - Char pointer to the c - string containing required substitutions \ param [ in ] fromChr - Char value to replace in src \ param [ in ] toChr - Char value to put in place of fromChr \ return Number of substitutions made
uint16_t lq_strReplace(char *srcStr, char fromChr, char toChr)
{
    char *opPtr = srcStr;
    uint16_t replacements = 0;
    if (fromChr == 0 || toChr == 0 || fromChr == toChr)
        return 0;
    while(*opPtr != 0)
    {
        if (*opPtr == fromChr)
        {
            *opPtr = toChr;
            replacements++;
        }
        opPtr++;
    }
    return replacements;
}
uint16_t lq_strReplace ( char * srcStr , char fromChr , char toChr ) { char * opPtr = srcStr ; uint16_t replacements = 0 ; if ( fromChr == 0 || toChr == 0 || fromChr == toChr ) return 0 ; while ( * opPtr != 0 ) { if ( * opPtr == fromChr ) { * opPtr = toChr ; replacements ++ ; } opPtr ++ ; } return replacements ; }
\brief Scans the source string for fromChr and replaces with toChr.
\ brief Scans the source string for fromChr and replaces with toChr .