In an email script/Velocity, what's the best way to anti-match a single value against a list of values in an if clause with several conditions?
For example: I could do
#set( $country = 'United States' ) #set( $list = ['United States','United Kingdom'] ) #if( !$list.contains($country) && 1 == 1 ) Salve, #else Dear friend, #end
#set( $country = 'Italy' ) #if( !$country.matches('^(United States|United Kingdom)$') && 1 == 1 ) Salve, #else Dear friend, #end
However, I am looking for a more direct and faster way in the veins of
#if( !['United States','United Kingdom'].contains($country) && 1 == 1 )
or something similar.
As I came across this question a few times already, I thought I'd ask.
Solved! Go to Solution.