String Delete (DELETE)
The DELETE instruction removes ASCII characters from a string.
The DELETE instruction deletes (removes) one or more characters from the Source and places the remaining characters in the Destination.
- The Start position and Quantity define the characters to remove.
- Unless Source A and the Destination are the same tag, Source A remains unchanged.
Available Languages
Ladder Diagram
_v1.png/_jcr_content/renditions/original)
FactoryTalk Design Studio
DSL - Ladder Diagram and
Structured TextDELETE(Source,Qty,Start,Dest);
Operands
There are data conversion rules for mixed data types within an instruction. See Data Conversion.
Ladder Diagram and Structured Text
Operand | Type | Format | Description | Notes |
|---|---|---|---|---|
Source | String | Tag | The tag that contains the string from which you want to delete characters | String types are:
|
Quantity | SINT
INT
DINT | Immediate Tag | The number of characters to delete | The Start plus the Quantity must be less than or equal to the length of the Source plus 1. |
Start | SINT
INT
DINT | Immediate Tag | The position of the first character to delete | Enter a number between 1 and the DATA size of the Source. |
Destination | String | Tag | The tag to store the result |
See Structured Text syntax Structured Text Syntax for more
information on the syntax of expressions within structured text.
Affects Math Status Flags
No
Major/Minor Faults
A minor fault will occur if: | Fault Type | Fault Code |
|---|---|---|
The LEN value of the Source string tag is greater than the DATA size of the Source string tag. | 4 | 51 |
The length of output string is larger than the DATA size of the destination string tag. | 4 | 52 |
The Start or Quantity value is invalid. | 4 | 56 |
See Common Attributes for operand-related faults.
Execution
Ladder Diagram
Condition/State | Action |
|---|---|
Prescan | N/A |
Rung-condition-in is false | N/A |
Rung-condition-in is true | The instruction executes. |
Postscan | N/A |
Examples
ASCII information from a terminal contains a header character. After the controller reads the
data (term_read.EM is on), the DELETE instruction removes the header character. The controller
can then use the text of the message or pass it on to another device

Structured Text
IF term_read.EM THEN DELETE(term_input,1,1,term_text); term_read.EM := 0; END_IF;
Provide Feedback