Topic: DMD0171

Help File Version: 2.9.4.37

STRSUB - Get Sub-String


The Get Sub-String (STRSUB) instruction will copy the specified characters from the Input String to the Output String.

 

 


Parameters:

Note: Use the F9 key to open the Default Element Selection Tool (the Element Picker or the Element Browser) or use the Down-Arrow key (Auto-Complete) on any parameter field to see a complete list of the memory locations that are valid for that parameter of the instruction.

 

Input String - this can be any user-defined or system-defined String.

 

Starting Offset - the offset of the first character to extract from the Input String. This can be any readable numeric location or any constant value between 0 and the maximum size of the Input String.

 


Offset From - specifies which end of the Input String is 'Offset 0'. The value for Offset From can be programmatically derived by the Find Within String (STRFIND) instruction.

 

  • Beginning - select this option if Offset From is relative to the first character in the Input String.
     

  • End - select this option if Offset From is relative to the last character in the Input String.

 


Length - specifies the number of characters to copy:

 

  • Number of characters - select this option to specify the number of characters to extract. This can be any readable numeric location or a constant value from 1 to the maximum number of characters in the Input String.
     

  • Remainder of Input String - select this option to extract all of the characters from the Offset to the end of the Input String.

 


Output String - specifies a String to store the extracted characters. This can be any writable user-defined or system-defined String. If the resulting contents of the STRSUB exceeds the maximum length of the output string, the output string will contain only the number of characters it can store (the remaining characters are lost) and a 'Buffer overflow' Warning will be generated.

 


Input Leg selects which of the following power-flow conditions will cause this instruction to run:

 

  • Edge Triggered means the instruction will run to completion each time the input ladder logic transitions from OFF to ON.
     
  • Power flow enabled means the instruction will run repeatedly as long as the input ladder logic remains ON.

 


Status Display:

 

The Status display will only show as many of the characters of the Input String and Output String as will fit within the borders of the instruction, typically this is about 50 characters.

 


See Also:

STR2REAL - Convert String to Real

 

STR2INT - Convert String to Integer

 

STRCASE - Convert String to UPPER / lower Case

 

STRCLEAR - Clear Strings

 

STRCMP - String Compare

 

STRCOPY - Copy String

 

STRCOPYR - Copy a Range of Strings


STRDELETE - Delete Substring

 

STRFIND - Find within String

 

STRINSERT - Insert Substring

 

STRPRINT - Print to String

 

STRSUB - Get Substring

 

STRTRIM - Trim Whitespace

 

STRTRUNC - Truncate String

 


Related Topics:

String Functions Overview

 

String Scripting Language Reference

 


Rung Example: