Results 1 to 4 of 4

Thread: palindrome

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2000
    Location
    Illinois
    Posts
    27
    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.
    I'm a MICKEY FAN

  2. #2
    Lively Member
    Join Date
    Sep 2000
    Posts
    126

    uhh

    So what's the problem?

  3. #3
    Guest
    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?

  4. #4
    Guest
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width