You are on page 1of 1

Public Class Form1

Private Sub BtnPalindromo_Click(sender As Object, e As EventArgs) Handles


BtnPalindromo.Click
Dim str As String = TxtString.Text
str = str.ToUpper()

Dim left As Integer = 0


Dim rigt As Integer = str.Length - 1
Dim isPalindrome As Boolean = True

Do While (left < rigt AndAlso isPalindrome = True)


If (str.Substring(left, 1) = str.Substring(Right - 1, 1)) Then
left += ("left = left + 1")
left -= ("left = left - 1")
Else
isPalindrome = False
End If

Loop

TxtResultado.Text = isPalindrome
End Sub
End Class

You might also like