patternMatch()
Checks whether a string has a particular pattern.
Synopsis
bool | dyn_bool patternMatch(string pattern, string s | dyn_string
ds);
Parameters
Parameter | Description |
---|---|
pattern | Pattern string. Pattern is case-sensitive also for Windows platform. |
s | Character string to be checked |
Return value
The function returns TRUE if the pattern matches otherwise, FALSE.
Error
Description
Checks whether the strings has the pattern specified in pattern. The asterisk "*" replaces any number of characters whereas the question mark "?" replaces any particular character and characters in brackets replace one of the characters specified in the brackets.
Example
The following example checks the correct and incorrect patterns for the string "otto.cc".
main()
{
bool retVal1, retVal2;
retVal1 = patternMatch("*.[abc]c", "otto.cc");
retVal2 = patternMatch("*.?", "otto.cc");
}
Assignment
Strings
Availability
UI, CTRL