• 0

Case-Insensitive EndsWith in VB.NET?


Question

I'm working on a personal program right now and I'm trying to get the EndsWith function to true any case-insensitive match if that makes sense.

If sMatch.EndsWith(sFileName) Then sListView.Items.Add(sMatch)

It only adds the case-sensitive match to my list view, how do I make it so it adds any case-insensitive match?

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

I got it to work using Regular Expressions (I've yet to learn everything in RegEx, seems like a headache)

If RegEx.IsMatch(Right(sMatch, Len(sFileName)), sFileName, RegexOptions.IgnoreCase) Then

sListView.Items.Add(sMatch)

End If

Link to comment
Share on other sites

  • 0

why dont you create a temp variable and perform a UCase() on it and what you're checking against?

-tell me if there's something i missed, i dont do .NET

Link to comment
Share on other sites

  • 0
why dont you create a temp variable and perform a UCase() on it and what you're checking against?

-tell me if there's something i missed, i dont do .NET

Why would you need to? weenur, explained it in the code he posted it would work, and UCase() if i'm not wrong is legacy function from VB6, you're encouraged to use functions the framework provides.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.