- Function AttributeContainsString(IdentifierName, AttributeName, Key)
AttributeContainsString
The function AttributeContainsString
returns 1 if the string representation of a specified attribute for a
given identifier contains the specified text (case sensitive).
AttributeContainsString(
IdentifierName, ! (input) scalar element parameter
AttributeName ! (input) scalar element parameter
Key ! (input) scalar string expression
)
Arguments
- IdentifierName
An element expression in the predefined set
AllIdentifiers
specifying the identifier.- AttributeName
An element expression in the predefined set
AllAttributeNames
specifying the attribute.- Key
A string specifying the text to search for.
Return Value
1 if the attribute text contains the Key string (always case sensitive), 0 otherwise. In case of failure, the return value is 0 and the predeclared identifier
CurrentErrorMessage
contains an appropriate error message.
Example
Given the declaration:
Parameter p {
Comment: "Hello""}
inside the nested module chapterModel::sectionModelQuery::funcAttributeLength
,
the code that queries the comment attribute of identifier p
is:
1 _ep_p := StringToElement(AllIdentifiers,
2 "chapterModel::sectionModelQuery::funcAttributeLength::p",
3 create: 0);
4 _bp_loPresent := AttributeContainsString(
5 IdentifierName : _ep_p,
6 AttributeName : 'comment',
7 Key : "lo") ;
8 block where single_column_display := 1, listing_number_precision := 6 ;
9 display { _ep_p, _bp_loPresent };
10 endblock ;
Remark:
Lines 1-3: Note that the name of the identifier contains all prefixes of the modules it is in.
The results in the listing file:
_ep_p := 'chapterModel::sectionModelQuery::funcAttributeLength::p' ;
_bp_loPresent := 1 ;