Hi guys,I need help with deleting repeated characters in a string
for example if the user inputs aab the returned string will be ab
I am using visual studio
i have this code so far but i am not getting a returned string.
Public Class Form1
Private Function CleanString(ByVal strng As String)
If strng.Length = 0 Then
Return strng
End If
Dim a As Char = GetChar(strng, strng.Length - 1)
Dim b As String = strng.Substring(0, strng.Length - 1)
If b.IndexOf(a) > -1 Then
Return CleanString(b)
Else
Return CleanString(b) And CleanString(a)
End If
End Function
Private Function GetChar(ByVal strng As String, ByVal index As Integer) As String
Dim chars() As Char = strng.ToCharArray()
Return chars(index)
End Function
Private Sub btnEval_Click(sender As Object, e As EventArgs) Handles btnEval.Click
Dim c As Char = txtInput.Text
txtOutput.Text = CleanString(c)
End Sub
End Class