Skip to main content

lengthIsMax

Short summary

This assertion method checks if the current string stringToCheck length is equal or less than to maxLength. Processed strings must be in Windows-1252 or Windows-1251 encoding

Attention: All strings are handled as null-terminated byte streams

Parameters

NameTypeCommentKind
stringToCheckPOINTER TO BYTEcurrent string to checkinput
maxLengthUDINTupper limit of the length of stringToCheckinput
messageAssertMessagemessage if the assertion is falseinput

Code

Declaration

METHOD lengthIsMax
VAR_INPUT
(* current string to check *)
stringToCheck :POINTER TO BYTE;
(* upper limit of the length of ``stringToCheck`` *)
maxLength :UDINT;
(* message if the assertion is false *)
message :AssertMessage;
END_VAR

Implementation

IF (THIS^.getStringLength(stringToCheck) > maxLength) THEN
THIS^.assertionWasWrong(message, THIS^.getDebugInfo('LengthIsMax'));
END_IF