Extract sub-string from middle (mid), C.7.5 extract sub-string from middle (mid) – Nematron Pointe Controller User Manual

Page 415

Advertising
background image

Pointe Controller User Guide

Appendix C: Ladder Diagram Block Reference

413

C.7.5 Extract sub-string from middle (MID)

When used in a Ladder Diagram, the MID block extracts a sub-string of specified
length from the middle of a string (variable or literal) and sends the result to an
output.

Select the

tool (from the

String Blocks

toolbar) and click on a ladder rung to

insert the following block:

Once the block is inserted, you can double-click on it to

configure

it.

Functional Description

This block always passes the Enable input state (EN) through to the Enable Out
output state (ENO) without change; when EN becomes on, ENO is turned on, and
when EN becomes off, ENO is turned off.

When EN becomes on, the block function is executed: a sub-string of up to
specified Length (LEN) is extracted from the Input String (IN), starting at the
specified Position (POS). The result is placed in the Output String (OUT).

For example:

IN: ‘Hello world. This is PointeControl.’

POS: 9

LEN: 8

OUT: ‘rld. Thi’

The block function is executed every time the ladder is

scanned

, so long as EN

remains on. If EN becomes off, then OUT remains at its last calculated value until
EN becomes on and the block function is executed again.

NOTE: If there are fewer than POS characters in the Input String, then the output
will be a null string.

Advertising