Sorting a .srt file for vlc player
-
i commented these lines
@ // QTextStream out(AjayFileD);
//out<<"\n"<<strc<<",000"<<"-->"<<strc<<",999"<<"\n";@and i added this code
@QStringList pauseTimes;pauseTimes << QString("%1,00-->%2,999").arg(strc).arg(strc); pauseTimes.sort(); QTextStream out(AjayFileD); out << pauseTimes.join("\n");@
thank you sir, but i'm getting this error
"collect2: ld returned 1 exit status" -
@ QStringList pauseTimes;
pauseTimes << QString("%1,000-->%2,999").arg(strc).arg(strc); pauseTimes.sort();
QTextStream out(AjayFileD);
out << "\n" << pauseTimes.join("\n") << "\n" ;@
the same code suggested by volker, and the result
00:00:00,000-->00:00:00,99900:15:34,000-->00:15:34,999
00:34:39,000-->00:34:39,999
00:05:28,000-->00:05:28,999
1:32:35,000-->1:32:35,999
1:15:11,000-->1:15:11,999
00:12:54,000-->00:12:54,999
as you can see the pause times are not getting sorted in ascending order,i think it's just some small change but I'm stuck and btw i'm a beginner -
Hi,
whatever you do, I checked the following code and it's output:
@
int main(int argc, char *argv[])
{
QStringList pauseTimes;
pauseTimes << QLatin1String("00:00:00,000—>00:00:00,999");
pauseTimes << QLatin1String("00:15:34,000—>00:15:34,999");
pauseTimes << QLatin1String("00:34:39,000—>00:34:39,999");
pauseTimes << QLatin1String("00:05:28,000—>00:05:28,999");
pauseTimes << QLatin1String("1:32:35,000—>1:32:35,999");
pauseTimes << QLatin1String("1:15:11,000—>1:15:11,999");
pauseTimes << QLatin1String("00:12:54,000—>00:12:54,999");std::wcout << std::endl << (wchar_t*)(pauseTimes.join("\n").utf16()) << std::endl ; std::wcout << L"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << std::endl; pauseTimes.sort(); std::wcout << std::endl << (wchar_t*)(pauseTimes.join("\n").utf16()) << std::endl ; return 0;
}
@The output was:
@
00:00:00,000ù>00:00:00,999
00:15:34,000ù>00:15:34,999
00:34:39,000ù>00:34:39,999
00:05:28,000ù>00:05:28,999
1:32:35,000ù>1:32:35,999
1:15:11,000ù>1:15:11,999
00:12:54,000ù>00:12:54,99900:00:00,000ù>00:00:00,999 00:05:28,000ù>00:05:28,999 00:12:54,000ù>00:12:54,999 00:15:34,000ù>00:15:34,999 00:34:39,000ù>00:34:39,999 1:15:11,000ù>1:15:11,999 1:32:35,000ù>1:32:35,999 @ For me, the output looks sorted....
-