C++ Builder 參考手冊(cè) ? System::Sysutils ? AnsiLastChar
返回指向字符串當(dāng)中最后一個(gè)字符的指針
頭文件:#include <System.SysUtils.hpp>
命名空間:System::Sysutils
函數(shù)原型:
System::WideChar * __fastcall AnsiLastChar(const System::UnicodeString S);
參數(shù):
- S:字符串
返回值:
- 如果 S 為空字符串,返回 NULL;
- 如果 S 不是空字符串,返回指向 S 里面最后一個(gè)字符的指針;
- 由 2 個(gè) char16_t 組成的代理對(duì) (4 個(gè)字節(jié)的字符) 可以正確的返回,請(qǐng)參考 UnicodeString 和 UTF16 編碼,這時(shí)候返回的就是倒數(shù)第 2 個(gè) char16_t 而不是最后一個(gè) char16_t;
- 返回的指針直接指向 S 占用的內(nèi)存,如果 S 是一個(gè)臨時(shí)對(duì)象,返回的指針指向的內(nèi)存被釋放,可能會(huì)被其他程序占用而無(wú)法得到正確的值;
相關(guān):
- 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
- <cstdlib>
C++ Builder 參考手冊(cè) ? System::Sysutils ? AnsiLastChar