Skip to main content

lengthIsMin

Short summary

This assertion method checks if the current string stringToCheck is length is equal or grater than to minLength

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

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

Parameters

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

Code

Declaration

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

Implementation

CASE stringToCheck.TypeClass OF
TYPE_CLASS.TYPE_STRING:
THIS^.utf8Assertions.lengthIsMin(
stringToCheck := stringToCheck.pValue,
minLength := minLength,
stringLengthUnit := stringLengthUnit,
message := message
);
TYPE_CLASS.TYPE_WSTRING:
THIS^.utf16Assertions.lengthIsMin(
stringToCheck := stringToCheck.pValue,
minLength := minLength,
stringLengthUnit := stringLengthUnit,
message := message
);
ELSE
; // do nothing
END_CASE