Change tab to space : String « Data Type « VB.Net Tutorial

VB.Net Tutorial
1. Language Basics
2. Data Type
3. Operator
4. Statements
5. Date Time
6. Class Module
7. Development
8. Collections
9. Generics
10. Attributes
11. Event
12. Stream File
13. GUI
14. GUI Applications
15. 2D Graphics
16. I18N Internationlization
17. Reflection
18. Regular Expressions
19. Security
20. Socket Network
21. Thread
22. Windows
23. XML
24. Database ADO.net
25. Design Patterns
Microsoft Office Word 2007 Tutorial
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial » Data Type » String 
2. 24. 13. Change tab to space
 
 


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 IntegerAs String

        Dim result As New System.Text.StringBuilder
        Dim counter As Integer

        For counter = To source.Length - 1
            If (source.Chars(counter= vbTabThen
                Do
                    result.Append(Space(1))
                Loop Until ((result.Length Mod tabSize0)
            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

 
2. 24. String
2. 24. 1. Declare String Variable and assign value
2. 24. 2. String.Empty
2. 24. 3. Demonstrating String class constructors
2. 24. 4. Join string
2. 24. 5. Copy characters from string1 into character Array
2. 24. 6. String Length property
2. 24. 7. Demonstrating method GetHashCode of class String
2. 24. 8. Insert sub string by index
2. 24. 9. Insert method returns the resulting string
2. 24. 10. SubString
2. 24. 11. Get string morse code
2. 24. 12. String operation timing
2. 24. 13. Change tab to space
2. 24. 14. ToString
2. 24. 15. Catch Exception for String.Substring
2. 24. 16. Count Vowels
2. 24. 17. Reverse a string
2. 24. 18. Make a reference copy
2. 24. 19. Check a Credit card number
2. 24. 20. Read String value from Keyboard
ww___w___._j___a___va___2_s___._c_o___m_ | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.