Hello! I need to write a program to find whether a word is a palindrome or not. What differentiates this from the other palindrome threads in this forum is that I can only use certain functions. They are: If statements, string functions (to upper, to lower, indoxof, length, substrings), for loop, do while loop, integers, decimals.
My idea is to count from both ends of the string, comparing characters as I go. However, my code doesn't seem to be working past the first and last characters. I would love some helpful feedback or suggestions.
My code so far:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim word, newword, ending As String Dim whole, beginning As Integer word = txtbox1.Text word = word.ToLower whole = word.Length - 1 ending = word.Substring(whole, 1) newword = word.Substring(beginning, 1) beginning = 0 If newword = ending Then beginning = beginning + 1 whole = whole - 1 newword = word.Substring(beginning, 1) ending = word.Substring(whole, 1) txtbox1.Text = "The word is a palindrome." Else : txtbox1.Text = "The word is not a palindrome."