Public Class Tester
Public Shared Sub Main
Dim tabs As String = "This~is~~a~tabbed~~~string".Replace("~"c, vbTab)
Dim spaces As String = TabsToSpaces(tabs, 8)
Dim periods As String = spaces.Replace(" "c, "."c)
Console.WriteLine(tabs)
Console.WriteLine(spaces)
Console.WriteLine(periods)
End Sub
Public Shared Function TabsToSpaces(ByVal source As String, ByVal tabSize As Integer) As String
Dim result As New System.Text.StringBuilder
Dim counter As Integer
For counter = 0 To source.Length - 1
If (source.Chars(counter) = vbTab) Then
Do
result.Append(Space(1))
Loop Until ((result.Length Mod tabSize) = 0)
Else
result.Append(source.Chars(counter))
End If
Next counter
Return result.ToString()
End Function
End Class
This is a tabbed string
This is a tabbed string
This....is..............a.......tabbed..................string