
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@639 8e941d3f-bd1b-0410-a28a-d453659cc2b4
31 lines
799 B
ObjectPascal
31 lines
799 B
ObjectPascal
unit uUtils;
|
|
|
|
{$mode objfpc}{$H+}
|
|
|
|
interface
|
|
|
|
function Iif(Cond:boolean; const TrueResult:String; const FalseResult:string):string;overload;
|
|
function Iif(Cond:boolean; const TrueResult:integer; const FalseResult:integer):integer;overload;
|
|
|
|
function IfEmpty(const S:String; const ThenReplace:string):string;
|
|
|
|
implementation
|
|
|
|
function IfEmpty(const S:String; const ThenReplace:string):string;
|
|
begin
|
|
if S = '' then Result:=ThenReplace else Result:=S;
|
|
end;
|
|
|
|
function Iif(Cond:boolean; const TrueResult:String; const FalseResult:string):string;overload;
|
|
begin
|
|
if Cond then Result:=TrueResult else Result:=FalseResult;
|
|
end;
|
|
|
|
function Iif(Cond:boolean; const TrueResult:integer; const FalseResult:integer):integer;overload;
|
|
begin
|
|
if Cond then Result:=TrueResult else Result:=FalseResult;
|
|
end;
|
|
|
|
end.
|
|
|