我嘗試了很多可能的解決方案來解決這個問題,但它似乎沒有工作。我的問題如下:我有一個包含多行的txt文件。每一行都有類似:如何從txt文件夾中剪切多個字符串#
xxxxx yyyyyy
xxxxx yyyyyy
xxxxx yyyyyy
xxxxx yyyyyy
...
我想在字符串中xxxxx
的一個陣列和另一個陣列的yyyyy
存儲,對txt文件的每一行,像
string[] x;
string[] y;
string[1] x = xxxxx; // the x from the first line of the txt
string[2] x = xxxxx; // the x from the second line of the txt
string[3] x = xxxxx; // the x from the third line of the txt
.. 。
and string[] y
;
...但我不知道如何...
我非常感激,如果有人告訴我如何使循環對於這個問題,我有。
問題didnt格式化好的......在file.txt的,每一行都有XXXXX YYYYY文本。 – thecner
那麼你有兩個(只有兩個)類別的字符串,你想分成兩個不同的數組?或者你需要檢查類別數量(重複)? – pijemcolu
只有2個類別,xxxxx和yyyyy – thecner