bool ON_WildCardMatchNoCase(const char* s, const char* pattern) { if ( !pattern || !pattern[0] ) { return ( !s || !s[0] ) ? TRUE : FALSE; } if ( *pattern == '*' ) { pattern++; while ( *pattern == '*' ) pattern++; if ( !pattern[0] ) return TRUE; while (*s) { if ( ON_WildCardMatch(s,pattern) ) return TRUE; s++; } return FALSE; } while ( *pattern != '*' ) { if ( *pattern == '?' ) { if ( *s) { pattern++; s++; continue; } return FALSE; } if ( *pattern == '\\' ) { switch( pattern[1] ) { case '*': case '?': pattern++; break; } } if ( toupper(*pattern) != toupper(*s) ) { return FALSE; } if ( *s == 0 ) return TRUE; pattern++; s++; } return ON_WildCardMatch(s,pattern); }
bool ON_WildCardMatch(const char* s, const char* pattern) { if ( !pattern || !pattern[0] ) { return ( !s || !s[0] ) ? true : false; } if ( *pattern == '*' ) { pattern++; while ( *pattern == '*' ) pattern++; if ( !pattern[0] ) return true; while (*s) { if ( ON_WildCardMatch(s,pattern) ) return true; s++; } return false; } while ( *pattern != '*' ) { if ( *pattern == '?' ) { if ( *s) { pattern++; s++; continue; } return false; } if ( *pattern == '\\' ) { switch( pattern[1] ) { case '*': case '?': pattern++; break; } } if ( *pattern != *s ) { return false; } if ( *s == 0 ) return true; pattern++; s++; } return ON_WildCardMatch(s,pattern); }
bool ON_String::WildCardMatch( const unsigned char* pattern ) const { return ON_WildCardMatch(m_s,(const char*)pattern); }
bool ON_String::WildCardMatch( const char* pattern) const { return ON_WildCardMatch(m_s,pattern); }