ByteToCharIndex - C++ Builder

C++ Builder 參考手冊 ? System::Sysutils ? ByteToCharIndex


包含某個編碼單元的字符是在字符串里面的第幾個字符,過時的函數(shù),需要用 ElementToCharIndex 代替

頭文件:#include <System.SysUtils.hpp>
命名空間:System::Sysutils
函數(shù)原型:

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

參數(shù):

  • S:字符串;
  • Index:編碼單元索引,UnicodeString 的編碼單元為 char16_t (或 wchar_t),AnsiString 的編碼單元為 char,由于一個字符可能由1個或多個 char16_t 或 char 組成的,所以第 n 個 char16_t 或 char 不一定是第 n 個字符;

返回值:

  • 第 Index 個編碼單元是字符串里面的第幾個字符;
  • 過時的函數(shù),需要用 ElementToCharIndex 代替;
  • 函數(shù)內(nèi)部只是簡單的調(diào)用 ElementToCharIndex,所以和 ElementToCharIndex 是相同的。

相關(guān):

  • 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::Sysutils ? ByteToCharIndex

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容