BDE 4.14.0 Production release
Loading...
Searching...
No Matches
ball::PatternUtil Struct Reference

#include <ball_patternutil.h>

Static Public Member Functions

static bool isMatch (const char *inputString, const char *pattern)
 
static bool isValidPattern (const char *pattern)
 

Detailed Description

This utility class provides functions relating to pattern matching for strings.

Member Function Documentation

◆ isMatch()

static bool ball::PatternUtil::isMatch ( const char *  inputString,
const char *  pattern 
)
static

Return true if the specified pattern matches the specified inputString, and false if the pattern does not match or is invalid. There are two types of escape sequences that are allowed in pattern. (See the function-level documentation of PatternUtil::isValidPattern for the definition of invalid patterns.) A '*escape sequence inpattern' matches a single * in inputString. A '\' escape sequence in pattern matches a single '\' in inputString. If pattern ends with an unescaped *, then pattern matches inputString if the string indicated by pattern (after escape sequence processing) with the final * removed is a prefix of inputString. Otherwise pattern matches inputString only if the string indicated by pattern (after escape sequence processing) and inputString are the same. The behavior is undefined unless both inputString and pattern are null-terminated c-style strings.

◆ isValidPattern()

static bool ball::PatternUtil::isValidPattern ( const char *  pattern)
static

Return true if the specified pattern does not contain a '\' not followed by either '\' or *, or an unescaped * at locations other than at the end, and false otherwise. Note that an unescaped * not at the end may someday be considered a valid pattern.


The documentation for this struct was generated from the following file: