System.AnsiStrings.ByteType

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function ByteType(const S: AnsiString; Index: Integer): TMbcsByteType;

C++

extern DELPHI_PACKAGE System::Sysutils::TMbcsByteType __fastcall ByteType(const System::AnsiString S, int Index)/* overload */;

Properties

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

Description

Indicates whether a byte in a string is a single-byte character, the first byte of a double-byte character, or the second byte of a double-byte character.

Call ByteType to determine whether a specified byte in a string is a single-byte character, the first byte of a multibyte character, or one of the trailing bytes.

AnsiString is the string that contains the byte in question.

Index identifies the byte whose type you want to know. Bytes are numbered from 1.

If the system is not using a multi-byte character system (MBCS), ByteType always returns mbSingleByte. Otherwise, ByteType returns mbSingleByte if the indicated byte represents a complete character in S, mbLeadByte if it represents the first byte of a double-byte character, and mbTrailByte if it represents a subsequent byte of a multibyte character.

Note: No checking is done to ensure that Index is less than the length of S. It is the caller's responsibility to ensure that Index is not out of bounds.

See Also