Материал: m912201e

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам

Standard Library Elements

319

String functions

 

 

 

Example in FBD:

Example in ST:

VarSTRING1 := LEFT ('SUSI',3);

Note:

String functions are not "thread safe"!

13.1.3RIGHT

Right returns the right, initial string for a given string.

RIGHT (STR, SIZE) means: Take the first SIZE character from the right in the string STR.

Input STR is of type STRING, SIZE is of type INT, the return value of the function is of type STRING.

Example in IL:

LD

'SUSI'

RIGHT 3

ST

VarSTRING1 (* Ergebnis ist 'USI' *)

Example in FBD:

Example in ST:

VarSTRING1 := RIGHT ('SUSI',3);

Note:

String functions are not "thread safe"!

13.1.4MID

Mid returns a partial string from within a string.

WAGO-I/O-SYSTEM 759 WAGO-I/O-PRO 32

320 Standard Library Elements

String functions

Input STR is type STRING, LEN and POS are type INT, the return value of the function is type STRING.

MID (STR, LEN, POS) means: Retrieve LEN characters from the STR string beginning with the character at position POS.

Example in IL:

LD

'SUSI'

RIGHT 2,2

ST

VarSTRING1 (* Ergebnis ist 'US' *)

Example in FBD:

Example in ST:

VarSTRING1 := MID ('SUSI',2,2);

Note:

String functions are not "thread safe"!

13.1.5CONCAT

Concatenation (combination) of two strings.

The input variables STR1 and STR2 as well as the return value of the function are type STRING.

Example in IL:

LD

'SUSI'

CONCAT

'WILLI'

ST

VarSTRING1 (* Ergebnis ist 'SUSIWILLI' *)

Example in FBD:

Example in ST:

VarSTRING1 := CONCAT ('SUSI','WILLI');

WAGO-I/O-SYSTEM 759 WAGO-I/O-PRO 32

Standard Library Elements

321

String functions

 

 

 

Note:

String functions are not "thread safe"!

13.1.6INSERT

INSERT inserts a string into another string at a defined point.

The input variables STR1 and STR2 are type STRING, POS is type INT and the return value of the function is type STRING.

INSERT(STR1, STR2, POS) means: insert STR2 into STR1 after position POS.

Example in IL:

LD

'SUSI'

INSERT

'XY',2

ST

VarSTRING1 (* Ergebnis ist 'SUXYSI' *)

Example in FBD:

Example in ST:

VarSTRING1 := INSERT ('SUSI','XY',2);

Note:

String functions are not "thread safe"!

13.1.7DELETE

DELETE removes a partial string from a larger string at a defined position.

The input variable STR is type STRING, LEN and POS are type INT, the return value of the function is type STRING.

DELETE(STR, L, P) means: Delete L characters from STR beginning with the character in the P position.

Example in IL:

LD 'SUXYSI'

DELETE 2,23

ST

Var1 (* Ergebnis ist 'SUSI' *)

WAGO-I/O-SYSTEM 759 WAGO-I/O-PRO 32

322 Standard Library Elements

String functions

Example in FBD:

Example in ST:

Var1 := DELETE ('SUXYSI',2,3);

Note:

String functions are not "thread safe"!

13.1.8REPLACE

REPLACE replaces a partial string from a larger string with a third string.

The input variable STR1 and STR2 are type STRING, LEN and POS are type INT, the return value of the function is type STRING.

REPLACE(STR1, STR2, L, P) means: Replace L characters from STR1 with STR2 beginning with the character in the P position.

Example in IL:

LD

'SUXYSI'

REPLACE

'K',2,2

ST

VarSTRING1 (* Ergebnis ist 'SKYSI' *)

Example in FBD:

Example in ST:

VarSTRING1 := REPLACE ('SUXYSI','K',2,2);

Note:

String functions are not "thread safe"!

13.1.9FIND

FIND searches for a partial string within a string.

WAGO-I/O-SYSTEM 759 WAGO-I/O-PRO 32

Standard Library Elements

323

Bistable Function Blocks

 

 

 

The input variable STR1 and STR2 are type STRING, the return value of the function is type STRING.

FIND(STR1, STR2) means: Find the position of the first character where STR2 appears in STR1 for the first time. If STR2 is not found in STR1, then OUT:=0.

Example in IL:

LD 'SUXYSI'

FIND 'XY'

ST

VarINT1

(* Ergebnis ist '3' *)

Example in FBD:

Example in ST:

arINT1 := FIND ('SUXYSI','XY');

Note:

String functions are not "thread safe"!

13.2 Bistable Function Blocks

13.2.1SR

Making Bistable Function Blocks Dominant:

Q1 = SR (SET1, RESET) means:

Q1 = (NOT RESET AND Q1) OR SET1

The input variables SET1 and RESET as well as the output variable Q1 are type BOOL.

Declaration example:

SRInst : SR ;

Example in IL:

CAL SRInst(SET1 := VarBOOL1, RESET := VarBOOL2)

LD SRInst.Q1

ST VarBOOL3

WAGO-I/O-SYSTEM 759 WAGO-I/O-PRO 32