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

Does :match() work when the string has no spaces?

Asked by 7 years ago
Edited 7 years ago

I'm trying to find a word in a string but the string is all 1 word

local Name = 'HelloWelcomeToThisWorld'
print( (Name:match('ToThis') ) 

does this work?

2 answers

Log in to vote
0
Answered by 7 years ago

This would work, as it is still inside the string, even if it is inside a word. The only thing that is wrong is that you added an extra parentheses, so your fixed code should be

local Name = 'HelloWelcomeToThisWorld'
print((Name:match('ToThis')) 

Hope this helps!

Ad
Log in to vote
-1
Answered by
OfcPedroo 396 Moderation Voter
7 years ago
Edited 7 years ago

That won't work, because with that, you're only setting one word, called 'HelloWelcomeToThisWorld'. There might be any method to bypass that, but with the scripting you have there, that won't work definitely.

If you found this answer helpful, please mark as the solution!

0
What? What do you mean by only setting one string? hiimgoodpack 2009 — 7y
0
i mistaken the word, sorry. You're only setting one word with the thing you pasted there up. OfcPedroo 396 — 7y

Answer this question