Show given string is palindrome or not

Posted by Satyapriyanayak under VB.NET category on | Points: 40 | Views : 1283
In this Code Snippet we will know whether given string is palindrome or not.

A palindrome is a word, phrase, number, or other sequence of symbols or elements, whose meaning may be interpreted the same way in either forward or reverse direction.

Ex:- ana

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim s1 As String
Dim s2 As String
s1 = Interaction.InputBox("Enter a string")
s2 = StrReverse(s1)
If (s1 = s2) Then
MessageBox.Show("Given string is palindrome")
MessageBox.Show("Given string is not palindrome")
End If
End Sub
End Class

Comments or Responses

Login to post response