System.AnsiStrings.ElementToCharLen

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

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

C++

extern DELPHI_PACKAGE int __fastcall ElementToCharLen(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 number of characters fully contained in the first MaxLen elements of a string.

Call ElementToCharLen to determine the number of characters represented by a portion of a string. ElementToCharLen counts characters until it reaches MaxLen elements or the end of the string, whichever comes first.

When working with multi-byte character systems (MBCS), the value returned by ElementToCharLen may be less than MaxLen or than the length of the string.

Note: ElementToCharLen counts a partial character if it appears as the last character of the first MaxLen elements.

See Also