Topic: DMD0172

STRTRIM - Trim Whitespace


The Trim Whitespace (STRTRIM) instruction will remove all whitespace characters from the beginning and/or end of a String. Whitespace characters between characters in the string are not removed.

 

Whitespace characters typically represent horizontal or vertical space, the ones the Trim Whitespace instruction will remove are:

  • Space <SP>

  • Horizontal Tab <TAB>

  • Carriage Return <CR>

  • Line Feed <LF>

  • Form Feed <FF>

  • Vertical Tab <VT>

 

Parameters:

Note: Use the F9 key (Element Browser) or Down-Arrow key (Auto-Complete) at any time to see a complete list of the memory locations that are valid in the current field of the instruction.

 

String - the String that contains the data to be trimmed. This can be any writable String element.

 

Trim - selects which end or ends of the string to trim
 

  • Leading - from the beginning of the string, working forward to the first non-whitespace character
     

  • Trailing - from the end of the string working backward to the first non-whitespace character

 


Status Display:

The Status display of the Trim Whitespace instruction will only display as many of the characters of the String as will fit within the borders of the instruction, typically this is about 50 characters.

 

Before executing the STRTRIM instruction:

 

After executing the STRTRIM instruction:


See Also:

 


Related Topics:

String Functions Overview

 

String Scripting Language Reference

 


Rung Example: