By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,483 Members | 1,045 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,483 IT Pros & Developers. It's quick & easy.

Case-insensitive comparision of strings

P: n/a
kd
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
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Kd,

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

Mystring.ToLower = MyOtherString.ToLower

I hope this helps?

Cor
Nov 21 '05 #2

P: n/a
"kd" <kd@discussions.microsoft.com> schrieb:
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))
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #3

P: n/a
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
"Cor Ligthert" <no************@planet.nl> escribió en el mensaje
news:OF**************@TK2MSFTNGP10.phx.gbl...
Kd,

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

Mystring.ToLower = MyOtherString.ToLower

I hope this helps?

Cor

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.