I'm not exactly sure what you mean by two arguments.
The examples in that link use:
unsigned found = str.find(str2);
found=str.find("haystack");
found=str.find('.');
For whatever reason I can use std::string.find() with just supplying a const literal or a string with a given value.
1 2
std::string srch {"The dog jumped over the moon"};
std::string.find{"dog"};
I'm assuming its' because the second argument(position) is default initialized to 0.
From what I understand Monkey you're trying to work with C-style string. Never really dabbled with that but the focus in this situation should be your use of erase().
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include <iostream>
#include <string>
usingnamespace std;
int main()
{
string test {"The dog and the cat"};
string srch {"dog"};
unsignedint pos = test.find(srch);
test.erase(pos, srch.size() + 1); //The second argument of erase tells how many chars to erase after pos.
cout << test;
}
And got:
terminate called after throwing an instance of 'std::out_of_range'
what(): basic_string::erase
So I removed EndLine.length() + 1 and just made it 2 and then 1, but kept getting the same error.