namespace std {
const wchar_t* wcsrchr(const wchar_t* s, wchar_t c); // (1)
wchar_t* wcsrchr(wchar_t* s, wchar_t c); // (2)
}
概要
ワイド文字列から文字を後方検索する。
戻り値
sが指す文字列の中で最後に現れるcを指すポインタを返す。見つからない場合はヌルポインタを返す。
備考
- この関数は、C++26からフリースタンディング処理系でも使用できる
例
#include <cwchar>
#include <iostream>
int main()
{
const wchar_t* s = L"hello";
const wchar_t* p = std::wcsrchr(s, L'l');
std::wcout << (p - s) << std::endl;
}
出力
3
バージョン
言語
- C++98
関連項目
wcschrstd::strrchr(): マルチバイト文字列版
参照
- P2338R4 Freestanding Library: Character primitives and the C library
- C++26で、この関数がフリースタンディング処理系で使用可能になった