It is easy to present list of allowed characters as string, like
(char-before) return integer.
How can I check that a character is in a string?
There is What is the easiest way to check if a character belongs to a particular set of characters? where
(memq ch (list ?a ?b)) is suggested.
I think that string is constant and don't need to be evaluated in comparison to
(list ?a ?b).
(seq-some (lambda (el) (eq el 32)) "a b") but it also is too high level.
It is possible to convert a character to string:
(string-match "[a b]" (char-to-string 32)).
If string is a sequence there is probably a function that detects element in a sequence...
(member 32 "a b") doesn't work...