correct way to check whether or not the string is in array