RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
SysUtils.CharToByteLen Function

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

Pascal
function CharToByteLen(const S: AnsiString; MaxLen: Integer): Integer; overload;
function CharToByteLen(const S: UnicodeString; MaxLen: Integer): Integer; overload;
C++
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!