2.2.3.15.26 string::Match

Description

String pattern matching, any number of wildcards are supported, which can be * or ?.

Syntax

BOOL Match( LPCSTR strPattern, BOOL bCaseSensitive = FALSE )

Parameters

strPattern
[input] the string will be matched.
bCaseSensitive
[input] false will not care the sensitive of char, true will be case-sensitive

Return

TRUE if the provided pattern matches the string.

Examples

EX1

void string_Match_ex1()
{
	string str = "abcdefg";
	bool bRet = str.Match("ab*");
	out_int("", bRet);//true
	
	bRet = str.Match("b*c*f?");
	out_int("", bRet);//false, since  "b*c" can not be found
	
	bRet = str.Match("a*e*");
	out_int("", bRet);//true
	
	bRet = str.Match("?*eg?");//false, since  "eg" can not be found
	out_int("", bRet);
}

Remark

See Also

Header to Include

origin.h