uniPatternMatch()

Checks whether particular string have a specific pattern.

Synopsis

bool uniPatternMatch( string pattern, string s);

Parameters

Parameter Description
pattern Pattern-String
s String whose letters are to be checked

Return value

Returns TRUE if the pattern was found in the string and FALSE if not.

Description

Checks whether the letters in the string s possess the pattern specified in the parameter pattern . The asterisk "*" replaces any number of characters, the question mark "?" replaces any character, characters in square brackets one of the characters specified in brackets.

Under Linux, the same rules for pattern apply as those that apply for Linux command lines for addressing files: These rules can be retrieved by using "man 5 regexp" on Linux computers.

Example

The function checks the pattern "*a" in the string: "cdeafgha".

  1. main()
    
    
    {
    
    
      string pattern;
    
    
      string ds1;
    
    
      bool ds2;
    
    
      pattern = "*a";
    
    
      ds1 = "cdeafgha";
    
    
      ds2 = uniPatternMatch(pattern, ds1);
    
    
      DebugN("The pattern is valid for = TRUE, not valid = FALSE. The function returns:" + ds2);
    
    
    }

The function returns:

WCCOAui1:["The pattern is valid for = TRUE, not valid = FALSE. The function returns:TRUE"]

Assignment

Dynamic arrays

Availability

CTRL