35b3c732创建于 2025年5月15日历史提交
// EXEC: cjc %import-path %L %l %f
// EXEC: ./main

import stdx.serialization.serialization.*
import stdx.encoding.json.*
import std.collection.*
import csv4cj.*

main() {
    var csvContent = #" 1 ,"2","\,"
        "\"",1"2",""""
        "",,
        1,,
        "#
    var format = CSVParseFormat.DEFAULT
    var csvReader = CSVReader(StringStream(csvContent))
    var csvParser = CSVParser(csvReader, format)
    var csvRecord = csvParser.nextRecord()
    csvRecord = csvParser.nextRecord()
    csvRecord = csvParser.nextRecord()
    csvRecord = csvParser.nextRecord()

    csvContent = #"@this is comment
        123|||abc|||"你||好"|||"#
    format = CSVParseFormat.DEFAULT.setCommentMarker(r'@').setDelimiter("|||")

    csvReader = CSVReader(StringStream(csvContent))
    csvParser = CSVParser(csvReader, format)
    csvRecord = csvParser.nextRecord()

    csvContent = "abc\n\r\ndef\n\n"
    format = CSVParseFormat.DEFAULT.setIgnoreEmptyLines(true)
    csvReader = CSVReader(StringStream(csvContent))
    csvParser = CSVParser(csvReader, format)
    csvRecord = csvParser.nextRecord()
    csvRecord = csvParser.nextRecord()
    csvRecord = csvParser.nextRecord()

    return 0
}