Thursday, August 7, 2008

The string function "EndsWith" is case-sensitive

Did you know that "EndsWith" String function is case-sensitive even in VB.NET?

You need to make sure you are looking for the correct string, since 'abc' with case-sensitivity is different than 'ABC'.

So, if your function is looking for 'abc', you must make sure that you make adjustments to the string, in order to catch things like this.

To do this, you would need to change:
myString.EndsWith("abc");
to
myString.ToLower.EndsWith("abc");

Source: https://www.nilebits.com/blog/2007/07/string-functions-startswith-and-endswith-are-case-sensitive-in-dot-net/

1 comment:

  1. Well I to but I think the post should acquire more info then it has.

    ReplyDelete