私は次のファイルを持っていtimesBetweenStartToEnd.txt
ます:
Starting at: 12:15:28 -> Ending at: 12:17:38 -> 130 Seconds
Starting at: 12:12:18 -> Ending at: 12:12:38 -> 20 Seconds
.....
秒数でソートし、ソートされた行を別のファイルに挿入したい: logTimes.txt
.
私は次のことを試しました:
string[] scores = System.IO.File.ReadAllLines("timesBetweenStartToEnd.txt");
var orderedScores = scores.OrderByDescending(x => int.Parse(x.Split(' ')[8]
.Substring(0,scores.IndexOf(" "))); // here I have an error because of `scores.`, I neead an index
foreach (var score in orderedScores)
{
System.IO.File.AppendAllText(@"logTimes.txt", string.Format("{0}{1}", orderedScores, Environment.NewLine));
}
したがって、logTimes.txt
次を含める必要があります(降順):
Starting at: 12:15:28 -> Ending at: 12:17:38 -> 130 Seconds
Starting at: 12:12:18 -> Ending at: 12:12:38 -> 20 Seconds
どんな助けでも大歓迎です!