Skip to main content

lengthIsMax

Short summary

This assertion method checks if the current string stringToCheck is length is equal or less than to maxLength

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

Parameters

NameTypeCommentKind
stringToCheckANY_STRINGcurrent string to checkinput
maxLengthUDINTupper limit of the length of stringToCheckinput
stringLengthUnitUnicodeStringLengthUnitstring length units of measurementinput
messageAssertMessagemessage if the assertion is falseinput

Code

Declaration

METHOD lengthIsMax
VAR_INPUT
(* current string to check *)
stringToCheck :ANY_STRING;
(* upper limit of the length of ``stringToCheck`` *)
maxLength :UDINT;
(* string length units of measurement *)
stringLengthUnit :UnicodeStringLengthUnit;
(* message if the assertion is false *)
message :AssertMessage;
END_VAR