Table of Contents

STRING_TO_BYTES

Function name

STRING_TO_BYTES

ST call

PROGRAM STRING_TO_BYTES_DEMO
VAR
    L: dint:=4;
 in_string: string := "AA@A";
    bytes: bytearray;
   in_string_ref : ref_to string;
END_VAR
  in_string_ref := REF in_string;
  bytes:=string_to_bytes(str:=in_string_ref,l:=L);   
END_PROGRAM

Description

The function converts a string to ASCII code values.

Inputs

InputType Description
STR STRING_REFInput character string reference
L DINT Number of characters to convert

Outputs

OutputType Description
BYTEARRAYArray of ASCII values

Application example