local t = "Hello, World"
local v = "Hello World"
I would like to know how to check if a string contains commas ...
local t = "Hello, World"
local v = "Hello World"
I would like to know how to check if a string contains commas ...
You can use the find
str = "Hello, World"
if string.find(str, ",") then
print ("Encontrou virgula.")
else
print ("Não encontrou virgula.")
end
If the search pattern is found the function returns the position (start and end) within the string where it was found.
> = string.find("Hello Lua user", "Lua")
7 9
> = string.find("Hello Lua user", "banana")
nil