For example, if:
for i in string.gmatch(str, "//")
will search for "//" in the string, how would i do the opposite so it returns every part of the string separated by "//"?
For example, if:
for i in string.gmatch(str, "//")
will search for "//" in the string, how would i do the opposite so it returns every part of the string separated by "//"?
you can use the //(.+) string pattern to get the characters after "//" excluding that, if thats what your looking for.
local str = "//hello world!"
for v in string.gmatch(str,"//(.+)") do
print(v)
end
hello world!
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Could you try -- for i in not string.gmatch(str,"//")
that would error