Equals

TwinCAT TIA
Tools String functions

ns=2;s=DEPRAG Smart/Utilities/StringOperations/Equals

Checks if two texts are the same.

Parameters:

    StrA
    The first text for comparison.
    StrB
    The second text for comparison
    IgnoreCase
    A boolean variable that specifies whether case should be ignored when comparing or not.

Returns:

    Equals
    A structure variable of the OpcMethodReturnValueBoolean type. The Result property contains the command-specific return values.
      Result
      A boolean variable that indicates whether the two texts are identical.

Examples:

In addition to the parameters already explained, the following variables must be created / transferred for the implementation in TwinCAT 3:

Beckhoff parameter:

    bStringEquals
    A boolean variable that can be used to trigger the execution of the Equals command.
    OutputDataStringEquals
    An instance of the "ST_BoolOutputData" structure into which the return value of the Equals method is written.
    hrStringEquals
    This can be used to monitor the execution of the command. Error codes have the type "HRESULT".
    fbStringOperations
    An instance of the "FB_StringOperations" function block supplied with the DEPRAG Smart library.
    StringOne
    The first string of type "STRING(80)" for the comparison.
    StringOneLength
    The length of the first strings to be compared.
    StringTwo
    The second string of type "STRING(80)" for the comparison.
    StringTwoLength
    The length of the second string to be compared.
    IgnoreCase
    A boolean variable that specifies whether case should be ignored when comparing or not.
    ConnectionHandle
    "ConnectionHandle" received when establishing a connection between DEPRAG Smart Server and your OPC UA client.


VAR
     bStringEquals   : BOOL;
     OutputDataStringEquals : ST_BoolOutputData;
     hrStringEquals   : HRESULT;

     fbStringOperations : FB_StringOperations;
END_VAR

hrStringEquals := fbStringOperations.StringEquals(
      bExecute    := bStringEquals, 
      ConnectionHandle := depragSmartConnection.ConnectionHandle,
      StringOne   := 'Ich bin ein String',
      StringOneLength  := SIZEOF('Ich bin ein String'),
      StringTwo   := 'String',
      StringTwoLength  := SIZEOF('String'),
      IgnoreCase   := TRUE, 
      OutputData   => OutputDataStringEquals);
IF hrStringEquals <> S_FALSE THEN 
      bStringEquals := FALSE;
END_IF
                                                    

For examples and explanations regarding the calls of nodes via Siemens TIA Portal please refer to the sub-menu "Siemens TIA Portal" in section "Getting Started".