Einzelnen Beitrag anzeigen

a.def
(Gast)

n/a Beiträge
 
#13

AW: Generelle Fragen zu TParallel.For

  Alt 31. Dez 2016, 21:22
Dein Ansatz funktioniert.
Folgender funktioniert auch
Beides scheint aber nicht perfekt zu funktionieren.

Delphi-Quellcode:
iTmp := -1;
iTmpEx := 0;

slMidIndex := slSource.Count div 2; // center of list's items
slHighIndex := slSource.Count - 1; // end of list

for i := slMidIndex to slHighIndex do
 Inc(iTmp);

for i := slHighIndex downto slMidIndex do
 Inc(iTmpEx);

ShowMessage('Von ' + IntToStr(0) + ' bis ' + IntToStr(iTmp) + sLineBreak + 'Von ' + IntToStr(iTmp + 1) + ' bis ' + IntToStr(slHighIndex));
 
// 9 Einträge
// Von 0 bis 4
// Von 5 bis 8

// 10 Einträge
// Von 0 bis 4
// Von 5 bis 9

// 11 Einträge
// Von 0 bis 5
// Von 6 bis 10

// http://stackoverflow.com/questions/9211772/how-to-split-one-stringlist-into-two-string-lists-in-delphi

Geändert von a.def (31. Dez 2016 um 21:34 Uhr)
  Mit Zitat antworten Zitat