write the code to reverse a string without using Strrev
built in function.
Answers were Sorted based on User's Feedback
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 |
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 | 8 No |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
We have an action attached with the library file in QTP. When I will click on run button,which file is going to be executed first a)Action b)Library
what r the 3 basic factor on which we determine to perform automation
What is FRAME WORK? How many Frameworks can QTP supports?
Hi All, I need Code For how to export Pass\Fail status to excell sheet without using QC. Thanks Balaji
How can we merge two repositories? Can we merge two differnt rep. I mean 1is peraction and other shared
4 Answers Tavant Technologies,
In VSS, HoW the documents send to local folder? copy paste or any other? plz explain about VSS TOOL kit?
breef description of batch testing ?
hi guys, pls tell me for testing institution training hub, hitech city is best or not?
can any body clearly explain about keyword driven framework .give me the explanation for files what ever you use in this frame work?
0 Answers Sapient, Satyam, TCS,
wht is Automation testing frame work. pls explain it
Can you give me the code to calculate the total number of Links using the child object in the web page..? is there any other way to calculate number of links with out using the Child objects.??
2 Answers DST Global Solutions,
What is object spy in quicktest professional?