how to reverse a string with out using string or predefined
function,ex:string is " i love india". the output should be
like this "i evol aidni"

Answers were Sorted based on User's Feedback



how to reverse a string with out using string or predefined function,ex:string is " i love ind..

Answer / karthikjanahan

Dim str,arr
str = "i love india"
strlen = len(str)
ReDim arr(strlen)
For i = strlen to 1 step -1
arr(i) = mid(str,i,1)
x = x & arr(i)
Next
msgbox x

Is This Answer Correct ?    10 Yes 5 No

how to reverse a string with out using string or predefined function,ex:string is " i love ind..

Answer / rupesh

Hi Karthik,
ur script will reverse the string but not the individual
words...

output of ur script will be "aindi evol i"

Is This Answer Correct ?    6 Yes 1 No

how to reverse a string with out using string or predefined function,ex:string is " i love ind..

Answer / nivas

The below given is perfect script for this Query.

Dim str
str = "i love india"
arr = split(str, " ")

for i=lbound(arr) to ubound(arr)
revStr = strreverse(arr(i))
fStr = fStr & revStr & " "
next

msgbox fStr

Is This Answer Correct ?    5 Yes 0 No

how to reverse a string with out using string or predefined function,ex:string is " i love ind..

Answer / janardhan

Given sting
String str="i love india";
String s[]=str.split();
for(int i=str.length();i>0;i--)
System.out.println(s[i]);

Is This Answer Correct ?    5 Yes 2 No

how to reverse a string with out using string or predefined function,ex:string is " i love ind..

Answer / praveen ponnala

hi guys

Try this

Dim MyStr, MyArray

MyStr = "I Love India"
MyArray = Split(MyStr," ")

msgbox StrReverse(MyArray (0)) &" " &StrReverse(MyArray
(1)) &" "&StrReverse(MyArray (2))

Is This Answer Correct ?    3 Yes 2 No

how to reverse a string with out using string or predefined function,ex:string is " i love ind..

Answer / rajender singh

aa = "i love india"
bb = split(aa," ")
dd = ""
For i=0 to ubound(bb)
cc = StrReverse(bb(i))
dd = dd&" "&cc
Next

msgbox dd

Is This Answer Correct ?    1 Yes 0 No

how to reverse a string with out using string or predefined function,ex:string is " i love ind..

Answer / sreenu

Dim str,arr
str = "i love india"

m=split(str," ")

For k=lbound(m) to ubound(m)
mystr=m(k)

strlen = len(mystr)
ReDim arr(strlen)
For i = strlen to 1 step -1
arr(i) = mid(mystr,i,1)

x = x & arr(i)

Next
x=x&" "
Next
msgbox x

Is This Answer Correct ?    0 Yes 0 No

how to reverse a string with out using string or predefined function,ex:string is " i love ind..

Answer / k.chalapathirao

i cheched it , but 8it is not reverse, plz chech it once

Is This Answer Correct ?    0 Yes 0 No

how to reverse a string with out using string or predefined function,ex:string is " i love ind..

Answer / ramesh

Str="I Love india"
arr1=split(Str," ")
for i=0 to ubound(arr1)
arr=arr1(i)
lenarr=len(arr)
if lenarr=1 then
sing=sing&arr&" "
End if
if lenarr<> 1 then
for j=lenarr to 1 step-1
val=mid(arr,j,1)
rev=rev&val&" "
next
end if
rev=rev&" "
next
msgbox sing&rev

Is This Answer Correct ?    0 Yes 0 No

how to reverse a string with out using string or predefined function,ex:string is " i love ind..

Answer / lak

Reverse a string without using String Functons
(mid,split,len..)

str=" i love india"

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

msgbox result

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More QTP Interview Questions

What is meant by Output Value in UFT?

0 Answers  


HI How to take screenshots of a Webpage and saving it in a external word document using QTP.

4 Answers   3i Infotech, TCS,


Hi all, I am New to QTP . I am Now in critical situtaion. I want to know How to create our own object respository for our application. please say the answer with example.

3 Answers  


Explain abt the File System Object in QTP with ex

3 Answers   Ordain Solutions,


Tell me few important difference Between QTP and WinRunner?

9 Answers   TCS,






How do you test siebel application using qtp?

2 Answers  


what is risks of testing a project?

5 Answers   AppLabs,


What are the technics follow in writing VB script?

0 Answers   CTS,


I have 5 save buttons in 5 tabs . The tabs are placed one after the other. My object repository have these added as 5 save buttons with name sav1, save 2, save 3 , save 4, save 5 .all are getting highlighted from OR but they are not getting clicked. After spying each button all the properties are same except First button Index 0 html id:=btnSaveTab1 outerhtml:=<input id=""btnSaveTab1"" class=""Button"" onclick=""document.getElementById('a1').click();"" name=""btnSaveTab1"" value=""Save"" type=""button"">", Second button "html id:=btnSave "outerhtml:=<input id=""btnSave"" class=""Button"" onclick=""document.getElementById('a2').click();"" value=""Save"" type=""button"">", Third button "html id:=", outerhtml:=<input id=""btnSaveTab1"" class=""Button"" onclick=""document.getElementById('a1').click();"" name=""btnSaveTab Fourth button "html id:=btnSave outerhtml:=<input id=""btnSave"" class=""Button"" onclick=""document.getElementById('a2').click();"" value=""Save"" type=""button"" 5th button "html id:=", "outerhtml:=<input class=""Button"" onclick=""document.getElementById('a5').click();"" value=""Save"" type=""button"">",

0 Answers  


How many types of actions are there in quicktest professional (qtp)?

0 Answers  


I want different types of discriptive programming statments coded for different types of web-objects?Give syntax and example?

2 Answers  


What is diffrence between Global variables and Environment variables...Anybody can give me answer..Thanks in advance..

3 Answers   IBM,


Categories