美文网首页
ByteToCharIndex - C++ Builder

ByteToCharIndex - C++ Builder

作者: 玄坴 | 来源:发表于2021-09-15 19:38 被阅读0次

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

相关文章

网友评论

      本文标题:ByteToCharIndex - C++ Builder

      本文链接:https://www.haomeiwen.com/subject/mipdahtx.html