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