|
|
|
Click here to copy the following block |
Public Function SplitWithQualifiers(ByVal SourceText As String, _ ByVal TextDelimiter As String, ByVal TextQualifier As String, _ Optional ByVal TreatMultipleDelimitersAsOne As Boolean) As String() Dim strTemp() As String, strRes() As String, I As Long, J As Long, _ A As strng, B As String, blnStart As Boolean
If TreatMultipleDelimitersAsOne Then Do While (InStr(1, SourceText, TextDelimiter & TextDelimiter) And (I < _ 100)) SourceText = Replace(SourceText, TextDelimiter & TextDelimiter, _ TextDelimiter) I = I + 1 Loop End If If TextDelimiter <> " " Then SourceText = Trim$(SourceText) strTemp() = Split(SourceText, TextDelimiter) For I = 0 To UBound(strTemp) J = InStr(1, strTemp(I), TextQualifier, vbTextCompare) If J Then A = Replace(strTemp(I), TextQualifier, "") Select Case strTemp(I) Case TextQualifier & A & TextQualifier B = B & A & vbCrLf blnStart = False Case TextQualifier & A B = B & A & TextDelimiter blnStart = True Case A B = B & A & TextDelimiter blnStart = False Case A & TextQualifier B = B & A & vbCrLf blnStart = False End Select Else If blnStart Then B = B & strTemp(I) & TextDelimiter Else B = B & strTemp(I) & vbCrLf End If End If Next I If B <> "" Then B = Left$(B, Len(B) - 2) strRes() = Split(B, vbCrLf) Else ReDim strRes(0) strRes(0) = SourceText End If SplitWithQualifiers = strRes() 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 ) |
|
|