Internet Direct (Indy)
Home
PreviousUpNext
BytesToChar Function

Converts a byte value to a character data type.

Pascal
function BytesToChar(
    const AValue: TIdBytes; 
    const AIndex: Integer = 0
): Char;
Parameters 
Description 
AValue 
Values to be converted to a character data type.
 
AIndex 
Initial position in the array of bytes to use when converting to the ordinal data type. Default value is 0 (zero). 

Char - Character data copied from the byte values specified.

BytesToChar is a Char function used to convert the value in AValue to a character data type. 

AValue is the array of bytes containing a value to be converted to a character data type. 

AIndex indicates the initial position in the array of bytes to use when converting to the ordinal data type. AIndex is a zero-based offset into the array of bytes. The default value for AIndex is 0 (zero). 

Please note that byte values in AValue should represent text using a single-byte character set. BytesToChar does not perform any conversion from MBCS to SBCS for values stored in AValue. In addition, no specific encoding is assumed (or handled) for byte values stored in the array of bytes. 

 

For the .Net platform, BytesToChar uses the ToChar method from the FCL System.BitConverter class to convert the value at the specified offset into the array of bytes. 

 

For all other platforms where the Borland RTL is supported, BytesToChar calls casts the byte value at the specified offset in AValue to the Char data type. All other byte values in AValues are ignored. 

Use BytesToString to convert a values in a TIdBytes data type to a String value. 

Use ToBytes to convert Char or String values to a TIdBytes data type.

Internet Direct (Indy) version 10.1.5
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Website http://www.indyproject.org.
Post feedback to the Indy Documentation newsgroup.