TRIM - Remove whitespace from a string

Help Contents


Removes the whitespace characters from the start or end of a string.


Informal Syntax:

TRIM( In, T )

Formal Syntax:

TRIM( In:=expression, T:=expression )


InANY_STRINGThe input string.
T ANY_INT The trim options:
1 = Remove whitespace from the start of the string.
2 = Remove whitespace from the end of the string.
3 = Remove whitespace from the both the start and end of the string.

The function is overloaded and accepts either the STRING or WSTRING type for the In parameter.

Return Value

The return value is the In string with the whitespace characters removed.

Whitespace characters between words or characters are not removed.

The type of the string returned is the same as the In parameter.


ExampleReturn Value
TRIM('', 3)STRING#''
TRIM(' Internet of Things ', 1)STRING#'Internet of Things '
TRIM(' Internet of Things ', 2)STRING#' Internet of Things'
TRIM(' Internet of Things ', 3)STRING#'Internet of Things'
TRIM(In:=" IoT ", T:=3)WSTRING#"IoT"

Standards Compliance

The function TRIM is an extension to the IEC 61131-3 standard.

Further Information

String Functions

To learn about other String Functions.

Common Elements

To learn about other IEC 61131-3 Common Elements.


For the meaning of terms used in Fernhill SCADA.