Topic Path: Symbol Reference > Functions > BytesToChar Function
ContentsIndexHome
PreviousUpNext
BytesToChar Function

Converts a byte value to a character data type.

File
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.

Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.