2.1.2.42 remove_str_from_str_list


Description

Remove a specified string from the string list separated by delimiter.

Syntax

bool remove_str_from_str_list( LPCSTR lpcszRemoved, string & strList, bool bFullMatch = true, string strDelimiter = "|" )

Parameters

lpcszRemoved
[input] string will be removed if found in strList.
strList
[modify] a list string, where the specified string will be removed.
bFullMatch
[input] specify whether to match a substring fully or not while searching for the target.
strDelimiter
[input] Delimiter of the two string. Only first charactor can be used.

Return

true if removement succeed, otherwise false.

Examples

EX1

bool remove_str_from_str_list_ex1()
{
    LPCSTR lpcszRemoved = "Mencius";
    string strList="Confucius\\Mencius";
    LPCSTR lpcszBefore = NULL;
    string strDelimiter = "\\";
    bool bFullMatch = true;
    if(remove_str_from_str_list(lpcszRemoved, strList, bFullMatch, strDelimiter))
        printf("%s\n",strList);
    else 
        printf("error");
    return 0;
}

Remark

See Also

Header to Include

origin.h

Reference