Resources » Code Snippets » String Manipulations


Updated: Category: String Manipulations
Author: Member Level: GoldPoints: 3

This function checks whether the given string is palindrome or not.

Private Sub Palindrome()
Dim strChar As String
Dim intI, intJ As Integer
Dim strAry(10) As String

strChar = "madam"
ReDim strAry(strChar.Length - 1)
For intI = 1 To strChar.Length
strAry(intI - 1) = Mid$(strChar, intI, 1)

intJ = strAry.Length - 1
For intI = 0 To strAry.Length - 1
If intI > intJ Then
Exit Sub
End If
If strAry(intI) = strAry(intJ) Then
intJ = intJ - 1
Exit For
End If
MessageBox.Show("Not Palindrome")
End Sub

In the above code,I have passed the string "madam" which is a palindrome.You may change it as per your requirement.

Did you like this resource? Share it with your friends and show your love!

Responses to "Palindrome"

No responses found. Be the first to respond...


Post Comment:

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)

    Type the numbers and letters shown on the left.

    Submit Article     Return to Article Index
    Subscribe to Subscribers
    Active Members
    TodayLast 7 Daysmore...

    Awards & Gifts
    Talk to Webmaster Tony John

    Online Members

    Vaishali Jain
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India