Hiya
I am trying to make a program on visual basic 5.0 to determine weather a
word or phrase is a palindrome or not. I need my program to be able to
tell if the word or phrase is a palindrome and it not being case
sensitive. The code below words to a certin point then brings up an
error but i have no clue why it wont work any help will be appreciated.
Thanks
I know some things that need to be inculued : arrays and fixed loops and it also needs to take out white spaces.
Dim i As Long
Dim lngLeft As Long
Dim lngRight As Long
pstrText = LCase$(pstrText)
lngLeft = 1
lngRight = Len(pstrText)
IsPalindrome = True
Do While lngLeft < lngRight
' Get left character
Do While lngLeft < lngRight
Select Case Asc(Mid$(pstrText, lngLeft, 1))
Case 97 To 122: Exit Do
End Select
lngLeft = lngLeft + 1
Loop
' Get right character
Do While lngRight > lngLeft
Select Case Asc(Mid$(pstrText, lngRight, 1))
Case 97 To 122: Exit Do
End Select
lngRight = lngRight - 1
Loop
If Mid$(pstrText, lngLeft, 1) <> Mid$(pstrText, lngRight, 1) Then
IsPalindrome = False
Exit Do
End If
lngLeft = lngLeft + 1
lngRight = lngRight - 1
Loop
End Function


