System.AnsiStrings.CharToElementLen

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function CharToElementLen(const S: AnsiString; MaxLen: Integer): Integer;

C++

extern DELPHI_PACKAGE int __fastcall CharToElementLen(const System::AnsiString S, int MaxLen)/* overload */;

Properties

Type Visibility Source Unit Parent
function public
System.AnsiStrings.pas
System.AnsiStrings.hpp
System.AnsiStrings System.AnsiStrings

Description

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

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

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

See Also