Right Click Disabled

Thursday, February 23, 2012

VBScript code in QTP to display given value is Palindrome


Option explicit
Dim val, res
val=inputbox("Enter any value : ")
res=strreverse(val)
If val=res Then
   msgbox(val&" is a Palindrome.")
   else
      msgbox(val&" is not a Palindrome.")
End If

OR

Option explicit
Dim val, res
val=inputbox("Enter any value : ")
res=strreverse(val)
If strcomp(val,res)=0 Then
   msgbox(val&" is a Palindrome.")
   else
      msgbox(val&" is not a Palindrome.")
End If

VBScript code in QTP to display given value in reverse


Option explicit
Dim val, res
val=inputbox("Enter any value : ")
res=strreverse(val)
msgbox("Reverse of  "&val&" is : "&res)

VBScript code in QTP to display last four characters in given value


Option explicit
Dim val, lastfour
val=inputbox("Enter any value : ")
lastfour=right(val,4)
msgbox("Last four characters in "&val&" is : "&lastfour)
Twitter Bird Gadget