Thursday, November 29, 2018

Simple Program to get the character count in a string using VBScript

=>here is the Simple Program to get the character count in a string using VBScript.

program:

Str="uzumaki naruto"

MsgBox len(Str) - len(replace(Str, "a", ""))

'Note: simply replace the "uzumaki naruto" with your string in quotes and "a" value with the character you want. it will work.

program of a pass by reference vs. pass by value in VBScript.

=>here is the program of a pass by reference vs. pass by value in VBScript.

program:

Dim a,b
a=10
b=20
Function fun(ByVal x,ByRef y)
x=100
y=200
End Function
Call fun(a,b)
Msgbox a&" "&b

Tuesday, February 16, 2016

angle between hands in a clock

Dim h,m
h=cint(inputbox("Enter the hour:"))
m=cint(inputbox("Enter the minutes:"))
If 5.5*m>30*h Then
msgbox 5.5*m-30*h
else
    msgbox 30*h-5.5*m
End If

just copy paste the code in QTP or UFT then you will get the angle between the hands in the clock

note: here the reference takes from clock wise and from 0 angle starts from 12 digit.

Monday, February 15, 2016

QTP finding lenght without len() method

Here it is....! How can we write a program in vbscript to find length of string without using len() function.

str="lengthofthestring"
i=1
do
str1=mid(str,i,1)
if str1<>"" then
i=i+1
else
exit do
end if
loop until str1=""
msgbox i-1


just copy paste the above code to QTP or UFT you will get the out put

Download and Installation of HP QTP Or UFT

here you will get full information of QTP and UFT....!

1)HOW TO INSTALL QTP AND HIGHER VERSIONS:

This post is regarding the QTP and higher versions installation steps :

From here the below link get the file:
UFT 12.5

save some where in the system and relax till it get downloaded.