Moschops
Practically a Master Poster
620 posts since Sep 2008
Reputation Points: 258
Solved Threads: 117
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 Master Poster
620 posts since Sep 2008
Reputation Points: 258
Solved Threads: 117
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 Master Poster
620 posts since Sep 2008
Reputation Points: 258
Solved Threads: 117
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 Master Poster
620 posts since Sep 2008
Reputation Points: 258
Solved Threads: 117