During a debugging session trying to find out why my a simple test to check a email address against a domain failed I discovered that String.EndsWith will return true if you try to compare a string and a empty string.
In my case I was checking list items with the format @domain.com against a valid e-mail address. But the function always returned the default choice. A “Please Choose” item with no domain configured. (A empty string)
In order to fix the problem I just added an if test to see if the string was empty and then ignored the EndsWith test.
This should have been a regular expression, but it works for now :-)
No comments:
Post a Comment