System.AnsiStrings.CharToElementIndex

De RAD Studio API Documentation
Aller à : navigation, rechercher

Delphi

function CharToElementIndex(const S: AnsiString; Index: Integer): Integer;

C++

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

Propriétés

Type Visibilité  Source Unité  Parent
function public
System.AnsiStrings.pas
System.AnsiStrings.hpp
System.AnsiStrings System.AnsiStrings

Description

Renvoie l'index de base 1 du premier élément d'un caractère spécifié dans une chaîne.

Appelez CharToElementIndex pour obtenir l'offset du caractère à une position spécifiée dans la chaîne S, où 1 spécifie le premier caractère, 2 le second, et ainsi de suite. CharToElementIndex renvoie zéro si Index est hors limites (Index <= 0 ou S contient moins de Index caractères). Si le paramètre Index indique un caractère à deux octets, CharToElementIndex renvoie l'offset du premier octet.

Si le système n'utilise pas un jeu de caractères multi-octets (MBCS), CharToElementIndex renvoie la valeur de Index, car il y a une correspondance 1:1 entre les octets et les caractères.

Voir aussi