ByteToCharIndex - C++ Builder

C++ Builder 参考手册 ➙ System::Sysutils ➙ ByteToCharIndex


包含某个编码单元的字符是在字符串里面的第几个字符,过时的函数,需要用 ElementToCharIndex 代替

头文件:#include
命名空间:System::Sysutils
函数原型:

int __fastcall ByteToCharIndex(const System::UnicodeString S, int Index);
int __fastcall ByteToCharIndex(const System::AnsiString S, int Index);

参数:

  • S:字符串;
  • Index:编码单元索引,UnicodeString 的编码单元为 char16_t (或 wchar_t),AnsiString 的编码单元为 char,由于一个字符可能由1个或多个 char16_t 或 char 组成的,所以第 n 个 char16_t 或 char 不一定是第 n 个字符;

返回值:

  • 第 Index 个编码单元是字符串里面的第几个字符;
  • 过时的函数,需要用 ElementToCharIndex 代替;
  • 函数内部只是简单的调用 ElementToCharIndex,所以和 ElementToCharIndex 是相同的。

相关:

  • System::Sysutils::BytesOf
  • System::Sysutils::WideBytesOf
  • System::Sysutils::PlatformBytesOf
  • System::Sysutils::StringOf
  • System::Sysutils::WideStringOf
  • System::Sysutils::PlatformStringOf
  • System::Sysutils::ByteLength
  • System::Sysutils::CharLength
  • System::Sysutils::StrCharLength
  • System::Sysutils::AnsiLastChar
  • System::Sysutils::AnsiStrLastChar
  • System::Sysutils::AnsiPos
  • System::Sysutils::AnsiStrPos
  • System::Sysutils::AnsiStrScan
  • System::Sysutils::AnsiStrRScan
  • System::Sysutils::CharToElementIndex
  • System::Sysutils::CharToElementLen
  • System::Sysutils::ElementToCharIndex
  • System::Sysutils::ElementToCharLen
  • System::Sysutils
  • std::mblen
  • std::_mbstrlen
  • std::strlen, std::_fstrlen, std::_tcslen, std::wcslen

C++ Builder 参考手册 ➙ System::Sysutils ➙ ByteToCharIndex

你可能感兴趣的:(ByteToCharIndex - C++ Builder)