string::rfind
Posted xpylovely
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了string::rfind相关的知识,希望对你有一定的参考价值。
string (1) |
size_t rfind (const string& str, size_t pos = npos) const noexcept; |
---|---|
c-string (2) |
size_t rfind (const char* s, size_t pos = npos) const; |
buffer (3) |
size_t rfind (const char* s, size_t pos, size_t n) const; |
character (4) |
size_t rfind (char c, size_t pos = npos) const noexcept;: |
#include <iostream>
#include <string>
using namespace std;
int main()
{
string s1 = "lyy is mulushu, but lyy is quiet";
string s2 = "lyy";
const char *s3 = "lyy";
cout << s1.rfind(s2) << endl;
cout << s1.rfind(s2, 30) << endl;
cout << s1.rfind(s3, 40, 2) << endl;
cout << s1.rfind(s3, 40, 3) << endl;
cout << s1.rfind(‘t‘, 20) << endl;
return 0;
}
以上是关于string::rfind的主要内容,如果未能解决你的问题,请参考以下文章