VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Verifies if a string you enter is a palendrome or not.

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.

Rate 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


Download this snippet    Add to My Saved Code

Verifies if a string you enter is a palendrome or not. Comments

No comments have been posted about Verifies if a string you enter is a palendrome or not.. Why not be the first to post a comment about Verifies if a string you enter is a palendrome or not..

Post your comment

Subject:
Message:
0/1000 characters