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 business process testing(bpt) in qtp?

0 Answers  


How to find Operating system information using QTP script?

0 Answers  


To count the no of links present in the yahoo home page i have written the script like this Set fileSysObject=createobject("Scripting.FileSystemObject") Set linksFileName=fileSysObject.opentextfile ("D:\samplelinkfile.txt",2,true) Set linkDescObj=description.Create linkDescObj("micclass").value="Link" Set noOfLinks=browser("yahoo").Page("Yahoo! India").ChildObjects(linkDescObj) For i=0 to noOfLinks.count-1 linkName=noOfLinks(i).getROProperty("name") linksFileName.writeline(linkName) Next linksFileName.close Set fileSysObject=nothing While running the script it showing error that object "yahoo"isnot found in the object repository. Is there any setting before running the script? if yes what is the steps for it.Im using QTP9.0

2 Answers  


w is output value

3 Answers   MBT,


How to find array size in qtp?

0 Answers  


hi i have one issue while selecting weblist i want show one particalur item in weblist .ex one weblist they are monday to sunday i want show the reporter like thurday in particular weblist can you help me about this thanks balaji

5 Answers  


1) after inserting the check point how to change the expected value that was captured while inserting the check point

2 Answers   TCS,


How to record application running on the Virtual machine?

0 Answers  


Why to use descriptive programming?

0 Answers  


What contains Data Driven Framework document in qtp?

0 Answers  


what is smart identification in qtp? pls any give details? thanks in advance

3 Answers   IBM,


1 Folders in VSS 2 In navigation script there are 100 script i want to run first 50 and 37th script also not needed to run how to do this 3 What is navigation script,Driver script, business script what we are loaded in this script 4 use of resource tab 5 Difference between verification and validation give real scenario example 6 file scripting object when to use it 7 what are the problems you are faced while testing web application 8 difference between expert view and keyword view 9 difference between QTP 8.2 and QTP 9.2 navigation frame work please answer these questions from real time working people as early as possible

0 Answers  


Categories