Moschops
Practically a Posting Shark
889 posts since Sep 2008
Reputation Points: 297
Solved Threads: 170
Skill Endorsements: 5
That page gives the four variations of the function that you can use. Note that in three of them, there is a default value provided for pos so you can feed it just one parameter if you need you, and accept the default value for the unspecified parameter.
All four of them return an object of type size_t. Generally, this is a number.
When you try to do this:
src=str.find_last_of(DRL);
where src is a string, you're telling the compiler that you want to use the find_last_of function that returns a string. There is no such function. Try
int position;
position=str.find_last_of(DRL);
Moschops
Practically a Posting Shark
889 posts since Sep 2008
Reputation Points: 297
Solved Threads: 170
Skill Endorsements: 5
error: no match for 'operator==' in 'src == str2'
Whatever types src and str2 are, the compiler does not know how to carry out the operator == on them. What types are they?
Moschops
Practically a Posting Shark
889 posts since Sep 2008
Reputation Points: 297
Solved Threads: 170
Skill Endorsements: 5
it is rightfully not sensible to compare an int and a string to see if they're identical.
If you want to check if the string DVL contains a colon, try this:
#include<iostream>
#include<string>
int main()
{
std::string DVL("something with:in the middle");
if (-1 != DVL.find(':'))
{
std::cout << "Found a colon";
}
else
{
std::cout << "Did not find" << std::endl;
}
return 0;
}
Moschops
Practically a Posting Shark
889 posts since Sep 2008
Reputation Points: 297
Solved Threads: 170
Skill Endorsements: 5
Question Answered as of 1 Year Ago by
Moschops