Subscribe to Subscribers

Resources » Code Snippets » String Manipulations

Palindrome


Posted Date:     Category: String Manipulations    
Author: Member Level: Gold    Points: 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)
Next

intJ = strAry.Length - 1
For intI = 0 To strAry.Length - 1
If intI > intJ Then
MessageBox.Show("Palindrome")
Exit Sub
End If
If strAry(intI) = strAry(intJ) Then
intJ = intJ - 1
Else
Exit For
End If
Next
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...

Feedbacks      

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.


    Next Resource: Reverse logic for string
    Previous Resource: Function to Sort comma(,) separated string
    Return to Resources
    Post New Resource
    Category: String Manipulations


    Post resources and earn money!
     
    More Resources
    Popular Tags   Tag posting guidelines   Search Tags  
    Palindrome  .  

    Active Members
    TodayLast 7 Daysmore...

    Awards & Gifts
    Talk to Webmaster Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2013 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.