Search This Blog

Friday, October 14, 2011

Replace ALL function

This function is used to replace the string in the entire string.

str replaceAll( str s, str findStr, str replStr )
{
    int pos = strscan( s, findStr, 1, strlen( s ) );
    ;
    while( pos > 0 )
    {
        s = strdel( s, pos, strlen( findStr ) );
        s = strins( s, replStr, pos );
        pos = strscan( s, findStr, pos + strlen( replStr ), strlen( s ) );
    }
     return s;
}

No comments:

Post a Comment

Thanks for visiting my blog,
I will reply for your comment within 48 hours.

Thanks,
krishna.