|
VBScript Subroutine to Split Up a Tab-Delimited Line of Text |
|
|
|
|
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 )
|