finding (whole word) substrings in string

Pages: 12
Thanks guys!

I'm not going to be able to work on this project for a couple of weeks because I have homework deadlines that I have to complete (this project is something I'm doing for fun).

When I get a chance to continue working on it I'll let you know if my issue is solved...
Thanks so much guys!
seeplus, jonnin

I seemed to have gotten it working with what you gave me for the most part other than if the input is "i'm okay" (I still want to run some more test though). Did the algorithm you posted cover the "i'm okay" issue?

I tried using the |= operator that you showed me but it said that I had to define that operator. Did you define it or is it included in a later version (I'm using Visual Studios 2017)?

thanks
Last edited on
what I posted should treat i'm as one word. Is that not what you want?

|= where, sorry? Ive slept since then... all I saw in my mess was a != (watch these, us a font that keeps them distinct!)
Last edited on
jonnin,

Yes "I'm" should be counted as one word, the issue is that "I'm ok" appears in the no vector but "Ok" appears in the yes vector. I'm trying to find a way for my function to differentiate between them.

|= appeared in the code posted by seeplus. I didn't understand it and seeplus explained that it's a bit or. When I tried using it though in Visual Studios 2017 it said that the operator was not defined, so I was wondering whether this operator is a new addition?

1
2
3
4
5
6
7
if (f + word.size() >= userInput.size() || std::isspace(userInput[f + std::size(word)])) 
{
				checkedResult |= typ; //this line
				userInput.erase(f, word.size());
				f = 0;
			}
Last edited on
if the input is "i'm okay" (I still want to run some more test though). Did the algorithm you posted cover the "i'm okay" issue?


The last code I posted correctly parses "i'm okay" as no.
seeplus,

I see that now. I was using your idea but was rewriting it with vectors. I found my mistake.

Thanks guys!
Topic archived. No new replies allowed.
Pages: 12