-
I have to write a simple program that checks for a palindrome(a word or sentence that reads the same from right to left and left to right...eye, eve). I have to enter a palindrome sentence into a text box it will check and see if it is a palindrome usind the whil loop statement. Punctuation must also be included. A form is also needed.
-
uhh
-
There you go. It doesn't use a loop, but it works.
Code:
If txtInput.Text = StrReverse(txtInput.Text) Then
'The string is a palindrome.
End If
Is it a school assignment? :p
-
There is a way WITH a while loop:
Code:
Dim intPosition As Integer
Dim strText As String
Dim strResult As String
strText = txtInput.Text
While intPosition =< Len(strText)
intPosition = intPosition + 1
strResult = Mid(strText, intPosition, 1) & strResult
Wend
If strResult = strText Then
MsgBox "The string is a palindrome!"
End If