MyChat Scripts: свойство TStringList.Sorted, включить или выключить сортировку списка строк

MyChat Scripts: свойство TStringList.Sorted, включить или выключить сортировку списка строк

"Для разработчиков", "Серверные скрипты", "Описание функций", "Строки", "TStringList", "Свойства", "Sorted".

 

Включить или выключить сортировку по алфавиту списка строк.

 

Синтаксис

property TStringList.Sorted: boolean;

 

Результат

True — если список нужно сортировать, False — если нет.

 

Пример

const
  DATA = 'Year one was lots of fun'#13#10 +
         'But nothin'' lasts forever in my dreams'#13#10 +
         'Two, I followed you'#13#10 +
         'Because you knew the way or so it seemed'#13#10 +
         'At three, I still believed'#13#10 +
         'That we would be becoming destiny'#13#10 +
         'At four l wanted more'#13#10 +
         'But you were movin'' on to better things';
var
  SL: TStringList;
begin
  SL := TStringList.Create;
  
  SL.Text := DATA;
  mLogScript(CRLF + SL.Text, 'unsorted');
  
  SL.Sorted := true;
  
  mLogScript(CRLF + SL.Text, 'sorted');
  
  SL.Free;
end.

Результат работы скрипта

[23:57:16] (Log "SortedProperty"): [unsorted]

Year one was lots of fun

But nothin' lasts forever in my dreams

Two, I followed you

Because you knew the way or so it seemed

At three, I still believed

That we would be becoming destiny

At four l wanted more

But you were movin' on to better things

[23:57:16] (Log "SortedProperty"): [sorted]

At four l wanted more

At three, I still believed

Because you knew the way or so it seemed

But nothin' lasts forever in my dreams

But you were movin' on to better things

That we would be becoming destiny

Two, I followed you

Year one was lots of fun

[23:57:16] (Run "SortedProperty"): Время выполнения скрипта: 5 мс

[23:57:16] (Run "SortedProperty"): Скрипт выполнен успешно.
 

Ещё посмотреть

mLogScript

TStringList.Add

TStringList.Create

TStringList.Free