I am parsing a text-file. While parsing, I want to skip certain characters (space, line-break, comma, period). In PHP, one may check the existence of a variable in an array with in_array(char, array)
, but things are obviously different given we are working with pointers.
I am currently writing it like this (excuse the weird formatting)
if (c == ' ' ||
c == '\n' ||
c == '.' ||
c == ',') {
continue;
}
But it feels a bit dumb. Is there a smarter/more compact way to perform multiple comparisons like this?