T
tshad
I am trying to find the most efficient way to run this.
If you have 4 variables: 2 zip codes and 2 cities. A person can supply a
zip code or not and a person can supply a city or not. I only want to test
the city if a city was passed and only want to pass a zip if zip is passed.
If both city and zip are passed both must passed.
Something like (I know this doesn't work):
string zip = "92780";
string zip2 = "92780";
string city = "";
string city2 = "tustin";
if ((zip != "" && (zip == zip2)) && (city != "" && (city ==
city2)))
do something
Where zip and city are the variable being passed and zip2 and city2 are
being returned.
In this case, if either zip or city are blank then the test fails.
So that if:
zip not blank and city blank - then only the zip = zip2 test counts and must
be true
city not blank and zip blank - then only the city == city2 test counts and
must be true
zip not blank and city not blank - then both zip == zip2 and city = city2
count and both must be true
zip blank and city blank - then the test fails.
Thanks,
Tom
If you have 4 variables: 2 zip codes and 2 cities. A person can supply a
zip code or not and a person can supply a city or not. I only want to test
the city if a city was passed and only want to pass a zip if zip is passed.
If both city and zip are passed both must passed.
Something like (I know this doesn't work):
string zip = "92780";
string zip2 = "92780";
string city = "";
string city2 = "tustin";
if ((zip != "" && (zip == zip2)) && (city != "" && (city ==
city2)))
do something
Where zip and city are the variable being passed and zip2 and city2 are
being returned.
In this case, if either zip or city are blank then the test fails.
So that if:
zip not blank and city blank - then only the zip = zip2 test counts and must
be true
city not blank and zip blank - then only the city == city2 test counts and
must be true
zip not blank and city not blank - then both zip == zip2 and city = city2
count and both must be true
zip blank and city blank - then the test fails.
Thanks,
Tom