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

Converts a TIdBytes value to a String datatype.

File
function BytesToString(
    const AValue: TIdBytes; 
    AStartIndex: Integer = 0; 
    AMaxCount: Integer = MaxInt
): string;
Parameters 
Description 
AStartIndex 
Initial byte position for the conversion.
 
AMaxCount 
Maximum number of bytes for the conversion. 
ABytes 
Values to be converted.
 

String - String representation of the TIdByte values.

BytesToString is a utility function used to convert the TIdBytes value in AValue to a String data type. 

AStartIndex indicates the initial byte position in ABytes to use for the conversion. AStartIndex is a zero-based offset into the array of bytes. 

AMaxCount indicates the maximum number of bytes for the conversion. 

BytesToString will raise an EIdRangeException error when ABytes has a length of zero (0) or when AStartIndex exceeds the last position availble for the number of bytes in ABytes (length - 1). 

 

For the .Net platform, the AnsiEncoding.GetString method from the framework is used to prepare the return value for the function. 

 

For other platforms, SetLength is called to initialize the return value and the Move procedure from the Runtime Library is used to prepare the return value for the function. 

Use one of the following utility functions to convert TIdByte values to another ordinal datatype: 

 

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