Search
Enter Keywords:
Home
VBScript Subroutine to Split Up a Tab-Delimited Line of Text PDF Print E-mail
User Rating: / 7
PoorBest 
Written by Michael Salsbury   
Wednesday, 15 June 2005

This VBScript function returns an array when given a line of tab-delimited text.

To use it, write a line of code like the following:

Dim theArray()
theText = "something tab delimited"
theArray = tabsplit(theText)

As with all my script code, this is provided as-is without warranty or support.  Use at your own risk.

'
' This function splits a line of text up based on the
' tabs it contains. The VB split function doesn't quite
' do the job, as it leaves out the last bit of text since
' there is no tab at the end of it.
'
Public Function tabSplit(thetext As String)
   On Error Resume Next
   Dim outList() As String
   ReDim outList(1) As String
  
   For i = 1 To Len(thetext)
     If Mid(thetext, i, 1) <> Chr(9) Then
        outList(UBound(outList) - 1) = outList(UBound(outList) - 1) & Mid(thetext, i, 1)
     Else
        x = UBound(outList()) + 1
        ReDim Preserve outList(x)
     End If
   Next i

   tabSplit = outList
 
End Function


Related Blogs:

Related Links:

Last Updated ( Monday, 11 July 2005 )
< Previous   Next >

Main Menu
Home
Blog
Photos
Links
Search
Site Index
Feedback
Administrator
Featured Links
BlogInspiration
SpamToons
Shawn Prince's Blog
Jack Ludwig's Blog
Mike Cramer's Site
Fark
Slashdot
Woot!
Cigar Envy
John Kricfalusi's Blog
CigarBlog 101
Cigars 101 Forum
Sponsored Links


View Site Stats