Aditional string library :
Code: Select all
Available types :
type IpHeader = array[4] of byte;
type MacHeader = array[6] of byte;
- Procedure Byte2Hex(data_hex : byte; var hex : string[2]);
//Convert Byte to Hex
//Ex. Byte2Hex(255,data_out);
- Function Hex2Byte(var hex : string[2]) : byte;
//Convert Hex string format (must be string[2]) into Byte
//Ex. res_8 := Hex2Byte('AA');
- Function Str2Byte(var byte_in : string[3]) : byte;
//Convert Byte string format (must be string[1] to string[3]) into Byte
//Ex. res_8 := Str2Byte('6');
//Ex. res_8 := Str2Byte('66');
//Ex. res_8 := Str2Byte(' 66');
//Ex. res_8 := Str2Byte(' 6');
- Function Str2Word(var word_in : string[5]) : word;
//Convert Word string format (must be string[1] to string[5]) into Word
//Ex. res_16 := Str2Word('9');
//Ex. res_16 := Str2Word(' 669');
//Ex. res_16 := Str2Word('96');
//Ex. res_16 := Str2Word(' 669');
- Procedure Ip2Str(var user_ip_addr : IpHeader; var str_out : string[15]);
//Convert ip ( array[4] of byte ) into string. Lenght of string is variable from 7 to 15.
//Ex. Ip2Str(Ip_address,data_out);
- Procedure Mac2Str(var mac_address : MacHeader; var str_out : string[12]);
//Convert mac ( array[6] of byte ) into string[12].
//Ex. Mac2Str(Mac_address, data_out);
- Procedure Str2Ip(var str_in : string[15]; var user_ip_addr : IpHeader);
//Convert string (lenght of string must be from 7 to 15 and must include 3 '.') into Ip format array[4] of byte
//Ex. Str2Ip('192.168.1.155', Ip_address);
- Procedure Str2Mac(var str_in : string[12]; var mac_address : MacHeader);
//Convert string (lenght of string must be 12) into Mac format array[6] of byte
//Ex. Str2Mac('00AA80FF457F', mac_address);
Library source is not available. Sorry !