EndsWith

TwinCAT TIA
Tools String functions

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

Checks if a text ends with another text.

Parameters:

    Value
    Value with which the end of ContainString is checked.
    IgnoreCase
    A boolean variable that specifies whether case should be ignored when comparing or not.

Returns:

    EndsWith
    A structure variable of the OpcMethodReturnValueBoolean type. The Result property contains the command-specific return values.
      Result
      A boolean variable that specifies whether the string to be searched occurs at the end of the string to be searched in.

Examples:

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

Beckhoff parameter:

    bStringEndsWith
    A boolean variable that can be used to trigger the execution of the EndsWith command.
    OutputDataStringEndsWith
    An instance of the "ST_BoolOutputData" structure into which the return value of the EndWith method is written.
    hrStringEndsWith
    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.
    ContainString
    The text being checked.
    ContainStringLength
    The length of the string to search in.
    Value
    Value with which the end of ContainString is checked.
    ValueLength
    The length of the string to be compared with the end of the string to be searched in.
    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
    bStringEndsWith    : BOOL;
    OutputDataStringEndsWith : ST_BoolOutputData;
    hrStringEndsWith   : HRESULT;

    fbStringOperations : FB_StringOperations;
END_VAR

hrStringEndsWith := fbStringOperations.StringEndsWith(
      bExecute     := bStringEndsWith, 
      ConnectionHandle  := depragSmartConnection.ConnectionHandle,
      ContainString   := 'Ich bin ein String',
      ContainStringLength  := SIZEOF('Ich bin ein String'),
      Value     := 'String',
      ValueLength    := SIZEOF('String'),
      IgnoreCase    := TRUE, 
      OutputData    => OutputDataStringEndsWith);
IF hrStringEndsWith <> S_FALSE THEN 
      bStringEndsWith := 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".