'EndsWith' is Case-Sensitive

Posted by David Wier on 04/5/10 | Tips and Tricks

The string function 'EndsWith' is case-sensitive, even in VB.Net, so if you're looking for a certain string (maybe the file extension, in a filename), you need to make sure you're looking for the correct thing, since 'xls', with case-sensitivity, is different than 'XLS'.

So, if you're function is looking for 'xls', you must make sure that you make adjustments to the filename string, in order to catch things like this. To do this, you would need to change:

if myFilename.EndsWith("xls")
to
if myFilename.ToLower.EndsWith("xls")































0 Comments

COMMENTS

Name:
URL:
Comment:

Comments are disabled for this article.