String:find() finds a word within a word

I want to use string:find() to get certain words from a sentence, the problem is that if I want (for example) to find the word “sleep” and I have another word in the sentence called “sleeping” it can find sleeping instead of “sleep”, I haven’t found a way to go around this yet.

Pad the word with spaces.
Ex:

string.find(str, " sleep ")

Solve your problem? Mark as solved.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.