Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Strict Off
- Option Explicit On
- Friend Class frmMain
- Inherits System.Windows.Forms.Form
- Dim Test_Palindromes As String
- Private Sub frmMain_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
- frmTestData.Show()
- End Sub
- Public Function ReverseString(ByRef strToReverse As String) As String
- Dim Result As String = ""
- For CharRev As Integer = 0 To strToReverse.Length - 1
- result += strToReverse(strToReverse.Length - 1 - CharRev)
- Next
- Return Result
- End Function
- Public Function RemoveSpecialChar(ByVal Test_String As String) As String
- Test_String = Test_String.Replace(",", "")
- Test_String = Test_String.Replace(" ", "")
- Test_String = Test_String.Replace("!", "")
- Test_String = Test_String.Replace(".", "")
- Test_String = Test_String.Replace("'", "")
- Test_String = Test_String.Replace("?", "")
- Test_String = Test_String.Replace("-", "")
- Return Test_String
- End Function
- Private Sub btnGetThem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGetThem.Click
- For Each Test_Palindromes As String In frmTestData.lstPhrases.Items
- If LCase(Trim(ReverseString(RemoveSpecialChar(Test_Palindromes)))) = LCase(Trim(RemoveSpecialChar(Test_Palindromes))) Then
- lstPalindromes.Items.Add(Test_Palindromes)
- Else
- lstNonPlaindromes.Items.Add(Test_Palindromes)
- End If
- lstPalindromes.Refresh()
- lstNonPlaindromes.Refresh()
- Next
- End Sub
- Private Sub btnCustom_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCustom.Click
- Dim Custom_Palindrome As String
- Custom_Palindrome = InputBox("Enter your test palindrome.", Me.Text)
- If LCase(Trim(ReverseString(RemoveSpecialChar(Custom_Palindrome)))) = LCase(Trim(RemoveSpecialChar(Custom_Palindrome))) Then
- lstPalindromes.Items.Add(Custom_Palindrome)
- Else
- lstNonPlaindromes.Items.Add(Custom_Palindrome)
- End If
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement