ByteToCharIndex - C++ Builder

C++ Builder 参考手册System::SysutilsByteToCharIndex


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

头文件:#include <System.SysUtils.hpp>
命名空间: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
  • <cstdlib>
  • std::strlen, std::_fstrlen, std::_tcslen, std::wcslen
  • <cstring>

C++ Builder 参考手册System::SysutilsByteToCharIndex

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容