0

.csv値が引用されているファイルがあります

Gender,ParentIncome,IQ,ParentEncouragement,CollegePlans
"Male",53900,118,"Encouraged","Plans to attend"
"Female",24900,87,"Not Encouraged","Does not plan to attend"
"Female",65800,93,"Not Encouraged","Does not plan to attend"

このファイルを次のコード (IntelliJ を使用し、デバッガーで値を観察) で読み取ると、引用符なしで値が返されます。

@Override
    public CsvConnectorService read(String fullFileName, String outputAddress, int intervalMs, boolean repeat,
                                    Handler<AsyncResult<Void>> result) {
        CSVFormat format = CSVFormat.RFC4180.withHeader().withIgnoreEmptyLines().withQuote('"');

        Subscription subscription = createCsvObservable(fullFileName, format, intervalMs, repeat)
                .subscribeOn(Schedulers.io())
                .subscribe(record ->

                        eventBus.publish(outputAddress, convertRecordToJson(record)));

        subscriptions.add(subscription);

        result.handle(Future.succeededFuture());
        return this;
    }

それを読んで.withQuote('"');も使わなくても、違いはありません。

4

1 に答える 1