This is a help and support site for everyone for tips, tricks and tutorials on QTP, automation frameworks & concepts. If you are planning to do HP Certification, this is the place to learn...
'Program to reverse a string without using strreverse
MyStr = inputbox("Enter the String:")
nCnt = Len(MyStr)
For i = 1 to nCnt
RevStr = Mid(MyStr,i,1)&RevStr
Dim str, revstr, strlenStr = "TestingQ"strlen = Len(Str)For i = strlen To 1 Step -1 revstr = revstr + mid (Str,i,1)Nextprint revstr'Msgbox revstr If instr(revstr, "QgnitseT") ThenReporter.ReportEvent micPass, "verify rev str", "reverse string pass" print "reverrse done is" & trueElseReporter.ReportEvent micFail, "verify rev str", "reverse string fail" print "reverse done is " & falseEnd If
thanks a lot
This is wrong. reverse the loop For nCnt to 1 Step -1
@ Chandrasekar : We need to repeat the reversing for every character. Where as in your logic, you are excluding one of the characters if you are trying from 1st character till last-1 (you are missing the last character). Looks like your logic needs a correction. BTW I already executed the above code and it works fine. Please let me know if you need any more information.
can u please elaborate the logic
hello wrong answer
I dont understand.. could you please elaborate?
Try this:dim a,bstr = inputbox("enter the string:")For n = len(str) to 1 step- 1b=Mid(str,n,1)a = a+bNextMsgbox ("the string is"&a)
hi,Can any one correct my code if it need to as am not getting required resultam trying to reverse a stringDim xx=inputbox("Enter a string")cnt=len(x)Do until cnt=0 y = mid(x,cnt,1)&y cnt=cnt-1Loopmsgbox y
Hi jayasree,please tell me..........what is "cnt"
@ jayasree - this will work : Dim xx=inputbox("Enter a string")cnt=len(x)Do until cnt=0y = y&mid(x,cnt,1)cnt=cnt-1Loopmsgbox y
Any know, How to open a windows based file. But should not using systemutil.run and invokeapplication. Any alternative way is their.
option explicitdim i,str1,str,slenstr = "string"i = 1slen = len(str)for i = slen to 1 step -1 str1 = str1&mid(str,i,1)nextmsgbox str1
I appreciate Nrusingha Acharya you put it in a simple way.
Ya u r correct..
Please leave your comment here...