help please w/ palindrome prog.

noneedforaname1
02-23-2005, 12:15 PM
i'm trying to make a program with a user that enters a string and the program tells you if the string is a palindrome or not (spelt the same backwords and forwards). I have most of it done but I need to put the string and the backwords version into two labels so the user can see if it is working right. I think I can do this somehow by taking the letters like RACeCAR all the letters except the very center and writing those 2 segments into two strings and comparing. Basically I'm a noob and I need help, the quicker the better so please respond. Thank you all

stevo
02-23-2005, 12:22 PM
have a look at the StrReverse() function

If StrReverse("racecar") = "racecar" Then
MsgBox "palindrome"
End If

you will also want to check for case sensitivity.

Jayanth Nayak K
02-23-2005, 12:24 PM
I will tell u the logic try code urself.. if u didnt make it i will give u next

the logic is simple
first find the legth of the string
u need a loop , looping legthofstring/2 times
in that loop check the first letter of original string and last letter of reversed string.
next compare first+1 letter of original string and last-1letter of reversed string

that's all

Be my Friend
--------------
Thanxs... :o

noneedforaname1
02-23-2005, 12:29 PM
wow you both helped a ton it took me 5 secs after reading those thanks so much

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum