Bookshelf Home | Contents | Index | Search | PDF | ![]() ![]() ![]() ![]() |
Siebel VB Language Reference > Siebel VB Language Reference >
StrComp Function
This standard VB function compares two strings and returns an integer specifying the result of the comparison.
Syntax
StrComp(string1, string2[, compare])
Returns
One of the following values:
Value Meaning -1 string1 < string2 0 string1 = string2 >1 string1 > string2 Null string1 = Null or string2 = NullUsage
If compare is 0, a case-sensitive comparison based on the ANSI character set sequence is performed. If compare is 1, a case-insensitive comparison is done based upon the relative order of characters as determined by the country code setting for your computer. If this argument is omitted, the module-level default, as specified with Option Compare, is used.
The string1 and string2 arguments are both passed as variants. Therefore, any type of expression is supported. Numbers are automatically converted to strings.
Example
This example compares a user-entered string to the string
Smith
.Option Compare Text
Sub Button_Click
Dim lastname as String
Dim smith as String
Dim x as Integer
smith = "Smith"
lastname = "smith"
x = StrComp(lastname,smith,1)
If x = 0 then
`You typed Smith or smith
End If
End SubSee Also
Bookshelf Home | Contents | Index | Search | PDF | ![]() ![]() ![]() ![]() |
Siebel VB Language Reference Published: 18 June 2003 |