SysUtils.CharToByteIndex
Contents |
Delphi Information
From SysUtils.pas
function CharToByteIndex(const S: AnsiString; Index: Integer): Integer; overload; function CharToByteIndex(const S: string; Index: Integer): Integer; overload;
Unit: SysUtils
Type: function
Visibility: public
C++ Information
From SysUtils.hpp
int __fastcall CharToByteIndex(System::AnsiStringT<0> S, int Index);
Unit: SysUtils
Type: function
Description
Returns the 1-based index of the first byte of a specified character in a string.
Call CharToByteIndex to obtain the byte offset for the character at a specified position in the string S, where 1 specifies the first character, 2 specifies the second character, and so on. CharToByteIndex returns zero if Index is out of range (Index <= 0 or S contains fewer than Index characters). If the Index parameter indicates a double-byte character, CharToByteIndex returns the offset of the first byte.
If the system is not using a multi-byte character system (MBCS), CharToByteIndex returns the value of Index, because there is a 1:1 correspondence between bytes and characters.