Results 1 to 6 of 6

Thread: What is the equivalent of "HasFieldsEnclosedInQuotes" in cCSV

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2017
    Posts
    761

    Question What is the equivalent of "HasFieldsEnclosedInQuotes" in cCSV

    The following works for me (VB.NET):

    Code:
            Dim sPath As String = "d:\test.csv"
    
            Dim iCount As Integer = 0
    
            Using afile As FileIO.TextFieldParser = New FileIO.TextFieldParser(sPath, System.Text.Encoding.GetEncoding(1252))
    
                Dim CurrentRecord As String() ' this array will hold each line of data
                afile.TextFieldType = FileIO.FieldType.Delimited
                afile.Delimiters = New String() {","}
                afile.HasFieldsEnclosedInQuotes = False
    
                ' parse the actual file
                Do While Not afile.EndOfData
    
                    iCount += 1
    
                    If iCount = 1684 Then
                        Stop
                    End If
    
                    CurrentRecord = afile.ReadFields
    
    
                    Dim s As String = ""
                    s = CurrentRecord(0)
    
                Loop

    The following does not:

    Code:
        Set mCsv = New_c.CSV
        mCsv.ExpectedEncoding = CP_UTF8
        mCsv.ReplaceDoubledQuotChars = False
        mCsv.ColSepChar = ","
        mCsv.ParseFile sPath, Me
    There seems to be a problem with quotes, but I don't see how to make RC6's cCSV behave like the other parser.

    I have attached a simple VB6 sample project. Please add RC6 as a reference to test it.

    Thank you!


    ps: The problematic string is this (I have anonymized it by replacing letters, but apart from that, that is the original string:

    20230210131552m3fhrarar8r844522hr43fa579fahr0p0mm,marmLm_PmmH,aaa hrpplmwhrrlm,aaa hrpplmwhrrlm,Frm Fmr 10 13:15:52 maw 2023,aaa mmaa,aa amlmvmry whrm mhram amm aa wmmaammr prmfmrmawmm apa ama.,"{""raaywaaamaa"":""mhr hrmzaa Phrkm mma Pmxx Pa-212 am, mmaahrmahramr maa mm ma,... wmram zmgmmamlla."",""rmaaaawaaamaa"":""Hier klicken"",""amm


    And here is the "too much" column contents:

    "rmaaaawaaamaa"":""Hier klicken"
    Attached Files Attached Files
    Last edited by tmighty2; Apr 30th, 2024 at 02:53 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width