by Kevin Somers (1 Submission)
Category: String Manipulation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 10th November 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Verifies if a string you enter is a palendrome or not.
'this function will determine whether the word you type into a textbox on the 'form is a palendrome or not after you click the command button
'a palendrome is word such as "pop" or "level" which spells the same forwards 'as backwards
'declare variables
Dim strWord As String
Dim strReverse As String
Dim i As Integer
strWord = Text1.Text
For i = Len(strWord) To 1 Step -1
strReverse = strReverse & Mid$(strWord, i, 1)
Next i
If UCase(strReverse) = UCase(strWord) Then
MsgBox "This IS a palendrome.", vbExclamation = vbOKOnly, "Yes Indeed"
Beep
Exit Sub
Else
MsgBox "This IS NOT a palendrome.", vbCritical = vbOKOnly, "Sorry"
End If