Okay so here is my issue, i can't seem to figure out how to search a string i have stored in a linked list. I need to search the string for the '@' character and then move forward and backwards to the first ' ' to get emails out of files.
I know this is a beginner issue, but i have been farting around with the .find() and other parts of string.h Can anyone point me in the right direction, please.
EDIT:
I just came across some code and am working on something like this, am i going in the right direction?
for (int i = 0; i < aStudent->str.length(); i++)
{
if (aStudent->str.at(i) == '@')
{
while (aStudent->str.at(i) != ' ') i--; // moving back to beginning
while (aStudent->str.at(i) != ' ') // moving forward again to end
{
aStudent->email += aStudent->str.at(i);
i++;
}
} // if
} // for
You could use the at() method to locate the '@' and then pass that location and the beginning/end of the string to the substr() method to get the tokens.