Lets say I have two values, "Baby", and "Dog". What I want to do is find both of those strings in one name in lighting, as in "Baby Dog". The thing is, I don't know how to find certain letters in strings to be able to do this.
✓ ANSWER ACCEPTED
How would i find certain letters in a string?
1 answer
✓ Accepted answer
You just use string.match. It matches strings. If it finds a match, it returns that match; otherwise it returns nil.
local str = "Baby Dog"
print( str:match("Baby") ) --> Baby
print( str:match("qwerty") ) --> nil
You can also use string patterns for less specific matching.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
You can use find function. string.find(originalstring,'Baby') or originalstring:find('Baby')