Login   /   Register

Case-insensitive string compare

Rate this article
     0 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 5
Loading ... Loading ...
April 1st, 2008 by daniva

Use the StrComp function and vbTextCompare argument to compare strings without case sensitivity.

string1 = "Alaska"
string2 = "California"
 
result = StrComp( string1, string2, vbTextCompare )
' result = 0 if the strings are identical (case-insensitive)
' result = -1 if string1 is lexicographically less than string2
' result = 1 if string1 is lexicographically greater than string2

Posted in VBScript

Leave a Reply

You must be logged in to post a comment.

This article was viewed 362 times