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

What is CMMP and CMMH?

0 Answers  


Anybody explain me, the concept of checkpoint declaration in the QTP mainly for the Objects, Pages, Text and Tables ?

1 Answers  


What type of VB script u had done in expert view?

1 Answers  


in qtp how we work with out put values and what is the process?

4 Answers  


Hi All, How to Compare two strings character by character in QTP

0 Answers  






what is smart identification?

7 Answers  


How QTP recognizes Objects in AUT?

1 Answers   Crea,


What are the Features & Benefits of Quick Test Pro (QTP)..?

5 Answers  


How should I get results when I run scripts in a Batch mode

1 Answers   TCS,


How to export data present in Datatable to an ".xls" file?

1 Answers   Crea,


Hi, I have a login page. To login in that page I need to have a valid username and password, which is stored in database. I imported that table to my DataTable in QTP (Global sheet). Now I need to write a code in qtp so that I can login only with valid username and data. my condition is : I want to get username and password from inputbox(which i did) and click on login button- which should verify the datatable for username and password and if value is present only then lofin else stop the testing. DataTable contains columns : LoginName and Password Code: Rowcount= DataTable.GetSheet("Global").GetRowCount msgbox "RowCount= " &RowCount,1 CurrentRow= DataTable.SetCurrentRow(1) Do Browser("").Page("").Frame("Frame").WebEdit("ctl10$ct l00$ctl00$UserName$ctl").Set DataTable("LoginName",1) Browser("").Page("").Frame("Frame").WebEdit("ctl10$ct l00$ctl00$Password$ctl").Set DataTable("Password",1) Browser("").Page("").Frame("Frame").Link("Login").Cli ck CurrentRow=CurrentRow+1 Loop Until CurrentRow>Rowcount Can anyone help? Thanks, Priya

3 Answers  


How to make Shared object repository in qtp 9.1 and 9.2?

2 Answers  


Categories