我有一個字符串被讀入,然後輸出到一個CSV文件,裏面有一個逗號。該字符串是CSV文件分隔
美國,B & w^1-25
所有我想要的是該字符串停留在一個特定的細胞,而不是被分成兩個不同的細胞。這可能有一個簡單的答案,但是我很難完成此任務。任何幫助將非常感激。這裏是我的輸出代碼,如果需要任何人想看看它...
public void printAll()
{
output2.WriteLine("All companies in order of sequence number, THIS IS OUTPUT 2!");
output2.WriteLine("___________________________________________________________________________________________");
int i = listHead2;
//Loops until the end of the list, printing out info
while (i != -1)
{
output2.WriteLine("{0}" + ", {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14}, {15}, {16}, {17}, {18}, {19}, {20}, {21}, {22}, {23}, {24}, {25}, {26}, {27}, {28}, {29}, {30}, {31}, {32}, {33}, {34}, {35}",
leaseName2[i], fieldName2[i],reservoir2[i], operator2[i], county2[i], state2[i], majo2[i], resvCatgory2[i], disRate2[i], netOil2Int2[i], netGas2Int2[i], workingInt2[i], grossWells2[i]
,ultOil2[i], ultGas2[i], grossOil2[i], grossNGL2[i], grossGas2[i], netOil2[i], netGas2[i], netNGL2[i], revToInt2[i], operExpense2[i], totInvest2[i], revOil2[i], revGas2[i], operatingProfit2[i],
revNGL2[i], discNetIncome2[i], seqNum2[i], wellID2[i], incASN2[i], lifeYears2[i], ownQual2[i], prodTax2[i], AdValorem2Tax2[i]);
i = pointers2[i];
}
}
謝謝。
這很好,非常感謝。 – Stock
對不起,也許你也可以幫忙。如果一個字符串有多個逗號,比如BROMIDE,HUNTON,MIS怎麼辦? – Stock
引號處理逗號,它只是一個字段中的「BROMIDE,HUNTON,MIS」 – Casperah