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

Will QTP Support Visual Foxpro Applications? If yes please tell me whether I need to install any additional addins for that?

0 Answers  


How can I open a EXCEL file from QTP Resultviewer with reporter.ReportEvent function call. Example: Test files for details click "here". And clicking "Here" in the resultviewer will open a local EXCEL FILE.

0 Answers   ING,


How to handle Dynamic Arrays?

0 Answers   Wipro,


what are the different Frame Works in Quick Test Proffessional testing

3 Answers   Wipro,


how can i call reusable action in a function could any one explain me?

2 Answers   Livetek,






how do we know whether all objects are stored in the object repository or not? how can we know if a particular object is not stored in the repository?

0 Answers  


i ve an excel in a QC folder. Thru my QTP script i want to open that excel in runtime. I am running this script from QC itself

4 Answers   TCS,


Can we call a parameter from an action to other action?

4 Answers  


How to test the login page in different ways in automation testing and i need code?

0 Answers   Cognizant,


Is it possible for QTP to capture the objects in word document.If so please give me the code.Thank you.

2 Answers  


VB scrip has a special command named LBound, which returns the starting index of an arry. What are the possible indexes an array can start with? options are given below. and one only the correct answer. pl select it 1. any index 2. only even non-negative 3. only 0 4. any non-negative integer

1 Answers  


Is it possible to split an action? How?

0 Answers  


Categories