Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is VB6 string comparison case insensitive?

Tags:

string

vb6

if strValue = 'Hello' then what would be the value of (strValue <> 'HELLO') be?

like image 298
Jon Erickson Avatar asked May 01 '09 21:05

Jon Erickson


People also ask

Is vb6 case sensitive?

Visual Basic is case-insensitive, but the common language runtime (CLR) is case-sensitive.

Are string comparisons case sensitive?

operators differs from string comparison using the String. CompareTo and Compare(String, String) methods. They all perform a case-sensitive comparison.

How do you compare strings case insensitive?

Comparing strings in a case insensitive manner means to compare them without taking care of the uppercase and lowercase letters. To perform this operation the most preferred method is to use either toUpperCase() or toLowerCase() function.

Is Strncmp case sensitive?

It is case-insensitive. The behavior is NOT undefined (it is well-defined) if either string is a null ptr. Regular strncmp() has undefined behavior if either string is a null ptr (see: https://en.cppreference.com/w/cpp/string/byte/strncmp).


2 Answers

It depends on how you use the Option Compare statement. It can work either way.

Option Compare Text 'Case insensitive'
Option Compare Binary 'Case sensitive (default)'

Here's a VB6 string tutorial.

like image 154
Jon B Avatar answered Oct 19 '22 08:10

Jon B


No, it's case sensitive (by default at least though you'll want to check - if Option Compare is set to Binary or not set then it's case sensitive, if it's set to text then it's case insensitive).

Lcase() both sides if you'd rather it were case insensitive.

The reason I prefer this to changing / setting option compare is that someone looking at the code doesn't have to go hunting to see what option compare is set to to understand how it's going to behave BUT it's almost certainly slower (not significantly unless you're calling it repeatedly) and some might see it as not particularly neat.

like image 35
Jon Hopkins Avatar answered Oct 19 '22 09:10

Jon Hopkins