I have a string "A001BBD0" and i want to know this info:
and that's it.
I found this pattern on web: "([a-zA-Z]).*(\1)" but it always returns nil for some reason
I guess i should split this string and check each symbol in several loops. I don't think this is a good idea (low performance)
i also found this topic but it doesn't give me any information
gsub returns the number of substitutions. So, try this code:
function repeats(s,c)
    local _,n = s:gsub(c,"")
    return n
end
print(repeats("A001BBD0","0"))
print(repeats("A001BBD0","B"))
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With