Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I check if a string includes a certain phrase?

Asked by
uui 35
4 years ago

I want to check if a variable named "custom" includes the text "http://www.roblox.com/asset/?id=" How would I go about doing this?

2 answers

Log in to vote
1
Answered by 4 years ago

So you could do something like this for an if statement

local Matched = string.match("https://whatsgood.com/", "https?://")

if not Matched then
    return 
end

print("found")
Ad
Log in to vote
0
Answered by
uui 35
4 years ago

Update: ~~~~~~~~~~~~~~~~~

print(string.match("https://whatsgood.com/", "https?://") ~= nil )

How would I do an if statement with this?

Answer this question