Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »


 
This function implements an extended version of the LIKE operation in the Express language as defined in section 12.2.5 in ISO 10303-11:1994(E) : The EXPRESS Language Reference Manual. The extension is that optionally the operation can do case insensitive comparison.
Header:
#include "sdai.h"
Prototype:
EdmiError edmiLike(SdaiString  operand1,
                    SdaiString  operand2, 
                    SdaiInteger options, 
                    SdaiLogical *result);  
Arguments:

operand1

The target string (left operand).

operand2

The pattern string (right operand).
The pattern matching characters are:@ Matches any letter^ Matches any upper case letter? Matches any character& Matches remainder of string# Matches any digit$ Matches a substring terminated by a spacecharacter or end-of-string* Matches any number of characters\ Begins a pattern escape sequence! Negation character (used with the othercharacters)

options

Specifies the options of the operation

result

Address of a SdaiLogical variable that receives the result of the operation.
The result is as follows:
sdaiTRUE: actual string matches specified pattern
sdaiFALSE: actual string does not match specified pattern
sdaiUNKNOWN: error in operation or at least one unset argument.

Option Description

CASE_SENSITIVE

Characters are compared case sensitive.
The interpretation of the pattern matching characters are as described in <operand2> argument.
CASE_SENSITIVE is the default behavior of the LIKE operation, i.e., when none of the options CASE_SENSITIVE and CASE_INSENSITIVE are set.

CASE_INSENSITIVE

Characters are compared case insensitive.
The interpretation of the pattern matching characters are as described in <operand2> argument.

 
Returns:
A completion code of datatype EdmiError is the returned function value. The completion code has the following values:
Completion code = 0 : Operation successfully performed.
Completion code != 0: Error in operation. Completion code is an EDMinterface error code. Use edmiGetErrorText to get the error text corresponding to the error code.
EXAMPLE
SdaiAppInstance currInst;
SdaiLogical result;
EdmiError rstat;
. . .
if (rstat = edmiLike ("\AAAA", "
A?AA", CASE_SENSITIVE, &result)) {
/* Error in operation */ 
printf("\nError: %s in edmiLike\n", 
edmiGetErrorText(rstat)); 
goto error; 
}
if (result == sdaiTRUE) {
printf("\nString: %s matches pattern: %s", "
AAAA", "\\\\A?AA"); 
}
. . .

  • No labels