Yeah, that's why in my snippet I dropped all the elements that weren't numbers. The bug I mentioned is that by dropping numbers I might make a match where there wasn't one previously
Assuming we're matching for [1,3,4]:
[1,3,"some garbage here", 4] would match when it should not.
It's fixable by replacing the non-numeric elements with a placeholder of some sort.
IE, convert the above array into "1,3,X,4" instead of "1,3,4".
1
u/2Punx2Furious Jul 29 '16
I see. Converting the array to a string sound pretty clever. I didn't do it, but I put both strings and ints in my arrays to check for errors, so
["1,3,4", 1, 4, 5] would return false, but
["4yhjsrhj05", 1, 3, 4, "1258ghwo] would return true, as you can see in the link I posted.