tommie Posted July 21, 2004 Share Posted July 21, 2004 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 More sharing options...
0 azcodemonkey Posted July 21, 2004 Share Posted July 21, 2004 how about sMatch.ToLower().EndsWith( sFileName.ToLower() ) Link to comment Share on other sites More sharing options...
0 tommie Posted July 21, 2004 Author Share Posted July 21, 2004 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 More sharing options...
0 anthonycara Posted July 22, 2004 Share Posted July 22, 2004 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 More sharing options...
0 Winston Posted July 22, 2004 Share Posted July 22, 2004 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 More sharing options...
Question
tommie
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