|
|
|
Click here to copy the following block |
Function SplitQuoted(ByVal Text As String, Optional ByVal Separator As String = _ ",", Optional ByVal Quotes As String = """") As String() ReDim res(100) As String Dim resCount As Long Dim index As Long Dim startIndex As Long Dim endIndex As Long Dim length As Long Dim sepCode As Integer Dim openCode As Integer length = Len(Text) If length = 0 Then SplitQuoted = Split("") Exit Function End If sepCode = Asc(Separator) openCode = Asc(Quotes) startIndex = 1 Do While index < length index = index + 1 Select Case Asc(Mid$(Text, index, 1)) Case sepCode If endIndex = 0 Then endIndex = index If resCount > UBound(res) Then ReDim Preserve res(0 To resCount + 99) As String End If res(resCount) = Mid$(Text, startIndex, endIndex - startIndex) resCount = resCount + 1 startIndex = index + 1 endIndex = 0 Case openCode startIndex = index + 1 endIndex = InStr(startIndex, Text, Right$(Quotes, 1)) index = endIndex End Select Loop If endIndex = 0 Then endIndex = length + 1 ReDim Preserve res(0 To resCount) As String res(resCount) = Mid$(Text, startIndex, endIndex - startIndex) SplitQuoted = res() End Function |
|
|
|
Submitted By :
Nayan Patel
(Member Since : 5/26/2004 12:23:06 PM)
|
|
|
Job Description :
He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting. |
View all (893) submissions by this author
(Birth Date : 7/14/1981 ) |
|
|