簡體   English   中英

FileHelpers庫CSV-為什么總是從右側的最后一列中刪除一個字母?

[英]FileHelpers library CSV - why is one letter always removed from the last column on the right?

我找到了一個非常好的讀取CSV文件的庫-FileHelpers ,但是我有一個奇怪的問題。 我將不勝感激。 提前致謝 !

映射后,我總是從右邊的最后一列中刪除一個字母。

我正在使用FileHelpers.dll版本FileHelpers_2_0_0_bin_docs_wizard.zip來自FileHelpers_2_0_0_bin_docs_wizard.zip 2.0的DotNet 2.0

例如,我有一個這樣的CSV(有些列被引用,有些沒有引用,它可能會改變)

name;surname
"John";Smith
"Jack";Baker

在讀取文件后:

FileHelperEngine<SemicolonsRow> engine = new FileHelperEngine<SemicolonsRow>();
engine.ErrorManager.ErrorMode = ErrorMode.SaveAndContinue;

res = engine.ReadFile("C:\\a.txt");

if (engine.ErrorManager.ErrorCount > 0)
engine.ErrorManager.SaveErrors("C:\\Log.txt");

我得到這個:

res[0].Col0 with name
res[0].Col1 with surnam  (lack of e at the end)
res[1].Col0 with John
res[1].Col0 with Smit  (lack of h at the end)

當我這樣讀取文件時:

name;surname;country
"John";Smith;USA
"Jack";Baker;Canada

問題在第三欄中-我得到: countr US Canad

我的FileHelpers類:

[IgnoreEmptyLines()]
[DelimitedRecord(";")]
public sealed class SemicolonsRow
{
    [FieldOptional()]
    [FieldQuoted('"', QuoteMode.OptionalForRead, MultilineMode.AllowForRead)]
    public String Col0;

    [FieldOptional()]
    [FieldQuoted('"', QuoteMode.OptionalForRead, MultilineMode.AllowForRead)]
    public String Col1;

    [FieldOptional()]
    [FieldQuoted('"', QuoteMode.OptionalForRead, MultilineMode.AllowForRead)]
    public String Col2;

    [FieldOptional()]
    [FieldQuoted('"', QuoteMode.OptionalForRead, MultilineMode.AllowForRead)]
    public String Col3;
}  

有任何想法嗎 ?

在發行之后解決了可選字段和其他一些問題,這是一個老問題,但我們卻沒有時間發布完整版本

您可以從此處下載解決問題的最新穩定版本:

http://teamcity.codebetter.com/viewLog.html?buildId=lastSuccessful&buildTypeId=bt66&tab=artifacts&guest=1

聽起來好像庫希望分隔符顯示為最后一個字符。 聯系圖書館的作者。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM