Palindrome program help anyone!!!!
Author |
Message |
zomg
|
Posted: Thu Oct 21, 2004 12:04 pm Post subject: Palindrome program help anyone!!!! |
|
|
Hi im new at VB and i having trouble with my palidrome project...
code: |
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" |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
McKenzie
![](http://www.wizards.com/global/images/swtcg_article_27_pic3_en.gif)
|
Posted: Thu Oct 21, 2004 1:07 pm Post subject: (No subject) |
|
|
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.
<pseudocode>
code: | ans = ""
for i = 1 to length
if Mid(word,i,1) >= "a" and Mid(word,i,1) <= "z"
ans = ans + Mid(word,i,1)
end if
next i
|
|
|
|
|
|
![](images/spacer.gif) |
zomg
|
Posted: Fri Oct 22, 2004 11:31 am Post subject: (No subject) |
|
|
thx so much
but where do i put that in the program? ![Embarassed Embarassed](http://compsci.ca/v3/images/smiles/icon_redface.gif) |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Fri Oct 22, 2004 9:54 pm Post subject: (No subject) |
|
|
umm.. processing the input right after you get the value from user would just make sence ![Very Happy Very Happy](http://compsci.ca/v3/images/smiles/icon_biggrin.gif) |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
donz
|
Posted: Wed Jan 05, 2005 1:23 am Post subject: Palindrome program |
|
|
can anyone here help me to look for a palindrome program... pls i need it badly.... ![Crying or Very sad Crying or Very sad](http://compsci.ca/v3/images/smiles/icon_cry.gif) |
|
|
|
|
![](images/spacer.gif) |
|
|