How to find given string is palindrome or not without using
strreverse() function?

Answers were Sorted based on User's Feedback



How to find given string is palindrome or not without using strreverse() function?..

Answer / amiricks

Hi Nitin concept is correct but above code is not working fine
as it shows only not a palindrome....

here i have written one simple code any suggestions are most
welcome

val = Inputbox("Enter any string")
L= LEN(val)
for i = L to 1 step -1
v= mid(val,i,1)
va = va&v
Next
if val= va then
msgbox "Name is a Palindrome"
Else
Msgbox "Not a palindrome"
End if


Regards
Amit
umesh.amitkumar@gmail.com

Is This Answer Correct ?    15 Yes 2 No

How to find given string is palindrome or not without using strreverse() function?..

Answer / nitin jagjivan

Strng = "NITIN"
temp = "Pass"
dim arr()

Strng_Length = len(Strng)
redim arr(Strng_Length)

For i=1 to Strng_Length
arr(i-1)= mid(Strng,i,1)
Next

For i=1 to round(Strng_Length/2)
If instr(ucase(arr(i-1)),arr(Strng_Length-
i)) = 0 then
temp = "Fail"
End If
Next

If temp <> "Fail" then
msgbox "Given input is a palindrome"
Else
msgbox "Try another String, Not Pali"
End If

Is This Answer Correct ?    5 Yes 3 No

Post New Answer

More QTP Interview Questions

Hi, how can we check or avoid the memory leakage in QTP9.2?

0 Answers   Arctern,


In my script there is a link(e.g. 'My Page') when I execute the script sometimes(not every time) QTP throws an error that "My Page(as link)" not found. Pleaase tell me where I need to update

3 Answers  


Hi All, How to get repeated word in string . Thanks Balaji

0 Answers  


I am using descriptive programming for my project.when QTP deosn't identity or recognize a object by record and playback method,is it possible to make QTP identify that object using descriptive programming? Note: The object doesn't have unique properties and same properties used in Record and playback are only available, no extra properties are defined.

3 Answers  


How do we retrieve the content from a text box in a web page

2 Answers  






When I used random numbers(1 to 9) with regular expression and run the test, it runs only 5 iterations with passed result instead of running all 1 to 9. Please tell me what can be the reason

0 Answers  


Explain the benefits of quick test pro(qtp)?

0 Answers  


how to export the result to notepad....for example i want to enter the user name and pass word and clicking on login button ......once you click on login button the corresponding page will open ...in that page you having one list box ...here you can get either success or failure ........friends here i want export the message what ever i got either success or failure .....how to export the result to note pad

1 Answers   Mind Tree,


What are software testing metrics

3 Answers  


what is qtp automation framework, what is the purpose of the framework and which folders included in this framework pls tell me with brief description

2 Answers   PSI Data Systems,


in one page we have 100 links i have to click the 99th link how can i click the 99th link.

4 Answers   GK Technologies, IBM,


what is the test process followed for your project?

1 Answers   ADP, Satyam,


Categories