Get every character that is behind a certain character?

This is gonna be a bit difficult to explain correctly but for instance there is a string “one, two”

how would i only print just “one two” by just going off of the “,” character?

1 Like

You mean like this?

local NewString = string.gsub(CharactersString, "," "")
2 Likes
print(table.concat(string.split("one, two", ",")))
1 Like

eh kind of but for i want it to return them as separate strings like return “one”, “two”

let me give another example so the string is “one, two, three, four” i only want it to return one and two but as separate strings

1 Like

Then Minh is the approach you’re looking for. After splitting, just get the first two outputs.

2 Likes

Thank you so much, I was trying to figure this out for a bit now!!!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.