Unfortunately, Tableau doesn't work the way
general programming languages do.
Besides, you shouldn't worry about how many values
are concatenated in the [Search] String Parameter.
Simply put as many ELSEIF statements as necessary
to max any reasonable number you're expecting from your users.