Automation testing QTP with VB Script functions Interview questions


Total available count: 68
Subject - Software Testing
Subsubject - Automation testing QTP with VB Script functions

StrComp Function?

StrComp function returns a value indicating the result of a string comparison. 

Syntax: StrComp(string1, string2[, compare])

Arguments:
string1: (Required) Any valid string expression.
string2: (Required) Any valid string expression.
compare: (Optional) Numeric value indicating the kind of comparison to use when
evaluating strings. If omitted, a binary comparison is  performed.

Example:

Str="Welcome to the World of QTP"
StrComp
Str1 = "QTP"
Str2 = "qtp"                                   
Print StrComp(Str1, Str2, 1)                           
Output: Returns 0 , which means Str1 is equal to Str2 for  textual comparison
Print StrComp(Str1, Str2, 0)                           
Output: Returns -1 , which means Str2 is  greater than  Str1 for  Binary comparison
Print StrComp(Str2, Str1)                               
Output:Returns 1, which means Str2 is  greater than  Str1 for  Binary comparison
Print StrComp(Str1, Str2)                                 
Output:Returns -1, which means Str1 is  less than  Str2  for  Binary comparison


 




Next 5 interview question(s)

1
StrReverse Function?
2
LTrim; RTrim; and Trim Functions?
3
InStr Function?
4
InStrRev Function?
5
Array Function?

Comments