
-----------------------------------
zomg
Thu Oct 21, 2004 12:04 pm

Palindrome program help anyone!!!!
-----------------------------------
Hi im new at VB and i having trouble with my palidrome project...


Dim a As String
Dim b As String
Private Sub Form_Activate()
a = InputBox("enter something to look for palindrome")
b = StrReverse(a)
If a = b Then
MsgBox ("That is a palindrome!!!!")
Else
MsgBox ("No, i am sorry")
End If
End Sub


i want it so that the program doesnt look for punctuation or spaces

right now i can type " racecar" and it will work but not "race car" or
"race, car"

-----------------------------------
McKenzie
Thu Oct 21, 2004 1:07 pm


-----------------------------------
I would make a function that would take a string and return a string with all of the spaces and punctuation stripped out. Use the Mid function to go through the word one letter at a time.

ans = ""
for i = 1 to length
     if Mid(word,i,1) >= "a" and Mid(word,i,1) 