Hi all ,Im trying to reduce string repetitions. Keeping same order to not alterate text. So exemple :
Would be :
I've been trying to figure out ;
But there i noticed that doesn't work on first strings and doesn't count all. If someone could lead me right , Id appreciate ! Thanks :afrog:
Code:
aabbbbbcccaaaa
Code:
a2b5c3a3
Code:
Dim a As String = vbNull
Dim b As String = vbNull
Dim c As String = vbNull
Dim tmpletter As String = vbNull
Dim cnt As Integer = 0
For Each i As String In RichTextBox1.Text
Dim tmpindex As String = RichTextBox1.Text.IndexOf(i)
Dim tmpindex2 As String = RichTextBox1.Text.IndexOf(i)
a = i
tmpindex += 1
tmpindex2 += 2
b = RichTextBox1.Text.Chars(tmpindex)
c = RichTextBox1.Text.Chars(tmpindex2)
If a = b Then
If b = c Then
If tmpletter = b Then
cnt += 1
Else
RichTextBox2.Text &= b & cnt
tmpletter = b
End If
End If
End If
Next