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

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

相当于Excel的IF函数

 

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