0

基本的に、次のようなデータのリスト全体があります。

text', 0, 16, 0, 160),
text text', 0, 36, 0, 720),
text text text', 6, 14, 200, 400),
text text', 6, 20, 40, 185),
text text text text', 6, 6, 80, 80),
text text', 0, 18, 0, 260),
text text text', 3, 3, 60, 60),

これを次のようにする必要があります。

(1444, text text', 0, 36, 0, 720),
(1445, text text text', 6, 14, 200, 400),
(1446, text text', 6, 20, 40, 185),
(1447, text text text text', 6, 6, 80, 80),
(1448, text text', 0, 18, 0, 260),
(1449, text text text', 3, 3, 60, 60),

だから私は基本的に数値を生成するために C# で for ループを書きました:

 for(int i =0; i < amount; i ++)
        {
            Console.WriteLine("("+counter+",");
            counter++;
        }

カウンターは必要な数であり、量は生成された数が必要な回数です。

各行ごとに「(1111,」を「text', 0, 0, 0, 0)」の前に取得する方法を見つけようとしています。メモ帳で検索して置換しようとしましたが、取得できませんでした動作するようにするには、C# ですべてを行う方法はありますか? それとも他の方法ですか?

4

3 に答える 3

5
var indexedLines = yourData.Select((line, idx) => new {Line = line, Index = idx});

foreach(var indexedLine in indexedLines)
    Console.WriteLine("({0}, {1}", indexedLine.Index, indexedLine.Line);
于 2012-12-14T16:29:46.453 に答える
4

Excel やその他のスプレッドシート プロセッサをそのまま使用することはできませんか?

于 2012-12-14T16:29:23.800 に答える
2
于 2012-12-14T16:30:10.047 に答える