What is the StrComp function?

Are you preparing for IT certification? With practice questions, study notes, interactive quizzes, tips and technical articles, uCertify PrepKits ensure that you get a solid grasp of core technical concepts to ace your certification exam in first attempt.

What is the StrComp function?

Rating:

The StrComp function is used to compare two strings alphabetically. The function takes three parameters. It is defined as follows:

StrComp(Str1, Str2, CompareMethod)

where, the first two parameters to the function (i.e., Str1 and Str2) are any valid String expressions that are to be compared. The third parameter (i.e., CompareMethod) is optional. If this parameter is not present, the Option Compare setting in the module determines the type of comparison. If this parameter is present, then it specifies the criteria of string comparison (either Binary or Text). If the Text comparison method is used, Visual Basic will ignore case when comparing letters. If the Binary comparison method is used, the case of the letters will matter.

The StrComp function returns the following values:

Return value Condition
-1If Str1 comes before Str2 in a sort based on ASCII code.
0 If Str1 is equal to Str2.
+1 If Str1 comes after Str2 in a sort based on ASCII code.


Rating:



Other articles

Click here to Article home

 
uCertify.com | Our Company | Articles | Privacy | Security | Contact Us | News and Press Release | uCertify India
MCSE: MCSA, MCTS, MCITP    JAVA Certification: SCJP, SCWCD Cisco Certification: CCNA, CCENT, A+, Network+, Security+
Oracle Certification: OCP 9i, OCP 10g, OCA 9i, OCA 10g CIW foundation    EC-212-32    CISSP    Photoshop ACE    Adobe Flash ACE
© 2008 uCertify.com. All rights reserved. All trademarks are the property of their respective owners.