https://docwiki.embarcadero.com/Libraries/Sydney/en/System.StrUtils.IfThen

function IfThen(AValue: Boolean; const ATrue: string; AFalse: string = ''): string;
uses System.StrUtils;

Delphi新语法IfThen_System

Delphi新语法IfThen_System_02

相当于Excel的IF函数

Delphi新语法IfThen_Boo_03

 

OrderStr := OrderStr + '[' + Columns[I].FieldName + '] ' + IfThen(Directions[I], ' ASC', ' DESC') + ',';