2.2.3.18.2 vector::Find

Description

Find a specified string in a string vector.

Syntax

int Find( LPCSTR lpcsz, int nStartRow = 0, BOOL bCaseSensitive = false, BOOL bFullMatch = true, int nEndRow = -1 )

Parameters

lpcsz
[input] the specified string to find
nStartRow
[input] start index in string vector, defaults to 0.
bCaseSensitive
[input] false, non-case compare.
bFullMatch
[input] true, full match compare.
nEndRow
[input] end index, -1 means end at last element.

Return

Return value will be -1 if lpcsz is not found else zero based index of element position.

Examples

EX1

void vector_Find_ex1()
{
    vector<string> vsExt = {"OPJ", "TXT"};
    if ( -1 == vsExt.Find("SPC") ) // if not found, returns -1
    {
    	out_str("No find!");
    }

    int ii = vsExt.Find("xT", 0, false, false);// if found will return the index
    out_int("ii = ", ii);
}

Remark

See Also

vectorbase::Find

Header to Include

origin.h