Reputation: 41
so I have a string that is outputted and it contains little sub strings in it, so it's formated like so "Glyph 1", "Glyph 19", "Glyph 22"
. What I want to do is to get a number of how many sub strings are in it. Now I know if it was a table that this would pretty easy, just put a '#' in front of it, but this is a string. I've tried using gmatch
and split
but gmatch seems to divide one string into sub strings and split just makes a table into a string containing sub strings. I'm sure there's some solution I've overlooked.
Upvotes: 4
Views: 176
Reputation: 2531
You can get just second reply from gsub:
local _, quantity = string.gsub(myString, "%s*\"[^\"]+\"%s*,?", "")
Upvotes: 2