GET_CHARRead a character value from the position of a string
This function gets the 8-bit character value of sString with iPosition denoting the position of the character in the string where 1 is the first character of the string.
The lower byte of the result contains the byte value, the upper bytes of the result byte value are filled with zeros.

Input
String from which the character is got
Position of the character which is got, where 1 is the first character of the string, must be greater than or equal to 1.
Output
The result byte value with the upper bytes filled with zeros.
The position is assumed to be greater than or equal to 1.
Please check the validity of the input data since the validity of the data to access is not checked.
Please check that the specified position does not exceed the maximum number of characters or is higher than the current number of characters.
To get the best performance please use constant input values as much as possible!
Inverse instruction: SET_CHAR

All input and output variables used for programming this function have been declared in the POU header.The same POU header is used for all programming languages.

VAR
bStart: BOOL:=FALSE;
sInputString: STRING[32]:='ABCDabcd';
wCharvalue: WORD:=16#61;
END_VAR
When the variable bStart is set to TRUE, the function is carried out.

BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 5 ;
NETWORK_BODY
B(B_CONTACT,,bStart,3,1,5,3,);
B(B_F,E_GET_CHAR!,,14,0,21,5,,?DEN?DsString?DiPosition?AENO?C);
B(B_VARIN,,sInputString,12,2,14,4,);
B(B_VAROUT,,wCharvalue,21,2,23,4,);
B(B_VARIN,,2,12,3,14,5,);
L(1,0,1,5);
L(1,2,3,2);
L(5,2,14,2);
END_NETWORK_BODY
END_NET_WORK
END_BODY
if (bSTart) then
wCharvalue:=GET_CHAR(sInputString, 2);
end_if;