RAD Studio VCL Reference
SysUtils.CharToByteLen Function

Returns the length, in bytes, of the first MaxLen characters of a string.

function CharToByteLen(const S: AnsiString; MaxLen: Integer): Integer; overload;
function CharToByteLen(const S: UnicodeString; MaxLen: Integer): Integer; overload;
int CharToByteLen(const AnsiString S, int MaxLen);
int CharToByteLen(const UnicodeString S, int MaxLen);

Call CharToByteLen to convert the length of a string in characters to the corresponding length in bytes. CharToByteLen returns the number of bytes required by the first MaxLen characters of S. If S contains fewer than MaxLen characters, CharToByteLen returns the byte length of S. 

If the system is not using a multi-byte character system (MBCS), CharToByteLen returns the length of S or MaxLen, whichever is smaller. 


Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!