Case-insensitive comparision of strings

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All,

How to perform case-insensitive comparision of strings?

Would there be some kind of an indicator, which when set to true, would
allow case-insenitive comparision of strings using if/select case, etc; after
performing the case-insenisitive compare, the indicator can be reset to allow
the conventional comparision of strings?

kd
 
Kd,

Just set both to lower or to upercase (what you prefer)

Mystring.ToLower = MyOtherString.ToLower

I hope this helps?

Cor
 
kd said:
How to perform case-insensitive comparision of strings?

\\\
Dim s1 As String = "HELLO"
Dim s2 As String = "hello"
MsgBox(CStr(StrComp(s1, s2, CompareMethod.Text) = 0))
///
 
Hi Cor,

I think that would be a bit inefficient. It is better to use:

String.Compare(ByVal strA As String, ByVal strB As String, ByVal ignoreCase
As Boolean) As Integer

--

Carlos J. Quintero

MZ-Tools 4.0: Productivity add-ins for Visual Studio .NET
You can code, design and document much faster.
http://www.mztools.com
 
Back
Top