write the code to reverse a string without using Strrev
built in function.




Answers were Sorted based on User's Feedback



write the code to reverse a string without using Strrev built in function...

Answer / jay prakash

Try this:

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''Script Starts Here''''''''''''''''''''''''''

Dim i
Dim iStrLen
Dim strOut
Dim strTmp
Dim strMyString

strString=InputBox("Please enter the string to be
reversed:")
iStrLen = Len(strString)
For i = 0 To Len(strString) - 1
strOut = Mid(strString, iStrLen - i, 1)
strTmp = strTmp & strOut
Next

strMyString = strTmp
msgbox strMyString



''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''Script Ends Here''''''''''''''''''''''''''

Please let me know if it helps

Is This Answer Correct ?    32 Yes 5 No

write the code to reverse a string without using Strrev built in function...

Answer / bhaskar

Str = InputBox("Please enter the string to be reversed:")
Cnt = len(str)
For i = 1 to Cnt
Rstr = mid(str , i ,1) &Rstr
Next
Msgbox Rstr

Is This Answer Correct ?    15 Yes 7 No

write the code to reverse a string without using Strrev built in function...

Answer / uday

All the above answers uses one the other string functions
like mid, len, instr.

But we can reverse a string without using any string functions.

Looks interesting? Try the below code:

str="Hello Uday"

Set regExpObj=new RegExp
regExpObj.pattern="[a-z A-Z]"
regExpObj.global=true

Set matches=regExpObj.execute(str)
For each letter in matches
result=letter.value&result
Next

print result

Is This Answer Correct ?    7 Yes 0 No




write the code to reverse a string without using Strrev built in function...

Answer / logesh gunasekar

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
char oldMsg[100], newMsg[100];
int cd = 12, cu = 0;
strcpy(newMsg, "Hello World!");
while (cd > 0)
{
newMsg[cu] = oldMsg[cd];
cu++;
cd--;
}
printf("%c", newMsg);
printf("\n\nPress ENTER to end . . .");
getchar();
return 0;
}

Is This Answer Correct ?    3 Yes 2 No

write the code to reverse a string without using Strrev built in function...

Answer / prasad

Option Explicit
Dim Str, Cnt , Rstr , i

Str = "Shiva"
Cnt = len(str)

For i = 1 to Cnt
Rstr = mid(str , i ,1) &Rstr
Next
Msgbox Rstr

Is This Answer Correct ?    11 Yes 11 No

write the code to reverse a string without using Strrev built in function...

Answer / prasd tl

Dim Str, Cnt , Rstr , i

Str = "Shiva"
Cnt = len(str)

For i = 1 to Cnt
Rstr = mid(str , i ,1) &Rstr
Next
Msgbox Rstr

Is This Answer Correct ?    2 Yes 2 No

write the code to reverse a string without using Strrev built in function...

Answer / chandrakanta

dim str,rs,i
str="chandrakanta panda"
rs=""
For i=0 to len(str)-1
rs=rs&mid(str,len(str)-i,1)
Next
print rs

Is This Answer Correct ?    2 Yes 2 No

write the code to reverse a string without using Strrev built in function...

Answer / rajesh kumar

can any one tel ;question is
a[1]=I
A[1]=N
A[1]=D
A[1]=I
A[1]=A
OUT PUT IS I NEED INDIA HOW WILL U DO THAT
USING A SIMPLE STRING
REPLY ME ITS NEED FUL.......

Is This Answer Correct ?    0 Yes 0 No

write the code to reverse a string without using Strrev built in function...

Answer / kondekar ashish k.

dim a, b as string
a=text1.text
b=strrev(a)
text2.text=b

Is This Answer Correct ?    0 Yes 0 No

write the code to reverse a string without using Strrev built in function...

Answer / prathyusha

without using built-in function we can go for RegExp.

str="Hello"
set oreg=new reg exp
oreg.global=true
oreg.ignorecase=true
oreg.pattern="[.]"
set omatches=oreg.execute("str")
for each match in omatches
res=match&vbcrlf&res
next
msgbox res

Is This Answer Correct ?    0 Yes 0 No

Post New Answer



More QTP Interview Questions

write a qtp code to display all the items in the fly from combo box or list box

3 Answers  


I am a new tester that needs to create an automatic script involving security questions. On a webpage I need to select a security question(which are random) from a drop down menu, and then input the answer as the last word from the security question. I have the script set-up to automatically select the first security question from the drop down. The problem I am having is trying to insert the security answer. How do I insert the security answer based on the selection from the security question?

0 Answers  


Differentiate the two Object Repository Types of QTP.

5 Answers  


HI! I have completed my testing course in 2008. but now am working in banking sector as a data analyst and i want to move to an IT based company but am unable to understand whether i have to complete the testing course again and try for a job .

1 Answers  


hi to all, i need a code.. in flight application 1.i need to login first then i need to insert 3 new orders... 2.i have to log out 3.i have to login again with different user 4.need to insert 2 new orders 5.then need to log out 6.then again login with different user 7.3 new orders create and log out 8.but we hv to do this using data table and actions please help me

0 Answers  






there are having 10 checkboxes..how can i check only first 5 check boxes by using descriptive programing..

10 Answers   HealthAsyst,


how to write the descriptive programming in QTP for loginwindow.without using Step generator,object repository for referecnes

4 Answers   STC,


What is throw object?

0 Answers  


Once the Actions are splitted , is there any way to merge them

3 Answers  


What is the Obect Repository type, we use in Automated Testing..in Real time.. Pls anybody can give the answer.. Thanks in advance...

5 Answers   Navis,


what r the verstions from 1st to present (verstions) of mercury tools (like winrunner,QTP,Loadrunner) ? Chandana

0 Answers   Wipro, Mannar Company,


How to run scripts 1,29,3,5,7,2 scripts using test batch runner in QTP.... Ie...I wanted to run scripts not in an order 1,2,3,4,5...like that How it is possible using test batch runner... I dont want hardcoded script

0 Answers   IBM,






Categories