24.01.2015 Views

PLC Programming

  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The Standard.lib library<br />

RIGHT<br />

Right returns the right, initial string for a given string.<br />

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

Input STR is of type STRING, SIZE is of type INT, the return value of the function is of type STRING.<br />

Example in IL:<br />

LD 'SUSI'<br />

RIGHT 3<br />

ST VarSTRING1 (* Ergebnis ist 'USI' *)<br />

Example in FBD:<br />

Example in ST:<br />

VarSTRING1 := RIGHT ('SUSI',3);<br />

Please Note: String functions are not "thread safe": When using tasks, string functions may only be used in a<br />

single task. If the same function is used in different tasks, there is a danger of overwriting.<br />

MID<br />

Mid returns a partial string from within a string.<br />

Input STR is type STRING, LEN and POS are type INT, the return value of the function is type<br />

STRING.<br />

MID (STR, LEN, POS) means: Retrieve LEN characters from the STR string beginning with the<br />

character at position POS.<br />

Example in IL:<br />

LD<br />

'SUSI'<br />

MID 2,2<br />

ST VarSTRING1 (* Ergebnis ist 'US' *)<br />

Example in FBD:<br />

CONCAT<br />

Example in ST:<br />

VarSTRING1 := MID ('SUSI',2,2);<br />

Please Note: String functions are not "thread safe": When using tasks, string functions may only be used in a<br />

single task. If the same function is used in different tasks, there is a danger of overwriting.<br />

Concatenation (combination) of two strings.<br />

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

Example in IL:<br />

10-40 CoDeSys V2.3

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!