7 delete, 8 replace, 9 find – Lenze DDS v2.3 User Manual

Page 301: Delete, Replace, Find, Drive plc developer studio

Advertising
background image

Drive PLC Developer Studio

IEC 61131-3 Standard functions

14-9

l

DDS EN 2.3

14.3.7

DELETE

Deletes a segment from a string from a specific position

STR1

is of type STRING, LEN and POS of type INT, the return value of the function type

STRING

.

DELETE(STR, L, P)

means: Delete L characters from STR, starting with the P th.

Examples
IL

ST

FBD

LD ’SUXYSI’
DELETE 2,2
ST Var1
(* Var1=’SUSI’ *)

Var1:=DELETE

(’SUXYSI’,2,2);

14.3.8

REPLACE

Replaces a segment within a string with another string

STR1

and STR2 are of type STRING, LEN and POS of type INT, the return value of the

function type STRING.

REPLACE(STR1, STR2, L, P)

means: Replace L characters from STR1 with STR2

starting with the P-th character.

Examples
IL

ST

FBD

LD ’SUXYSI’
REPLACE ’K’,2,2
ST Var1
(* Var1=’SKYSI’ *)

Var1:=REPLACE

(’SUXYSI’,’K’,2,2);

14.3.9

FIND

Looks for a segment within a string

STR1

and STR2 are of type STRING, the return value of the function type INT.

FIND (STR1, STR2)

means: Find the position of the first character of the first occurrence

of STR2 in STR1.

If STR2 does not occur in STR1 , the return value will be :=0.

Examples
IL

ST

FBD

LD ’SUXYSI’
FIND ’XY’
ST Var1 (* Var1=3 *)

Var1:=FIND(’SUXYSI’,’XY’);

Show/Hide Bookmarks

Advertising