Skip to main content

endsWith

Short summary

This assertion method checks if the current string stringToCheck ends with end

Attention: All strings are handled as null terminated byte/word streams. For windows-1252 is end of the string 16#00 For UTF-16 is end of the string 16#00_00

Attention: Method uses ANY_STRING and for this it's not possible to use literals/constants, because for ANY types the compiler generates__SYSTEM.AnyType and __SYSTEM.AnyType contains a pointer

Attention: end of the string is ALWAYS the right side of the string even for writings which written from right to left like Hebrew or Arabic

Parameters

NameTypeCommentKind
stringToCheckANY_STRINGcurrent string to checkinput
endANY_STRINGexpected end of stringToCheckinput
messageAssertMessagemessage if the assertion is falseinput
ignoreCasesBOOLTRUE means ignore cases; FALSE means cases must be equal tooinput
trimBOOLTRUE means truncation of spaces on the right side of stringToCheckinput
normalizeStringsBOOLnormalize both strings for checkinput

Code

Declaration

METHOD endsWith
VAR_INPUT
(* current string to check *)
stringToCheck :ANY_STRING;
(* expected end of ``stringToCheck`` *)
end :ANY_STRING;
(* message if the assertion is false *)
message :AssertMessage;
(* ``TRUE`` means ignore cases; ``FALSE`` means cases must be equal too *)
ignoreCases :BOOL := FALSE;
(* ``TRUE`` means truncation of spaces on the right side of ``stringToCheck``*)
trim :BOOL := FALSE;
(* normalize both strings for check *)
normalizeStrings :BOOL := TRUE;
END_VAR