Show: Delphi C++
Display Preferences


From RAD Studio API Documentation
Jump to: navigation, search


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


extern DELPHI_PACKAGE int __fastcall CharToByteIndex _DEPRECATED_ATTRIBUTE1("Use CharToElementIndex.") (const System::AnsiString S, int Index)/* overload */;


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


Warning: CharToByteIndex is deprecated. Please use CharToElementIndex.

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.

See Also

Personal tools
RAD Studio 10.2 Tokyo
In Other Languages
Previous Versions