summaryrefslogtreecommitdiff
path: root/docview/src/docdump/u_Tools.pas
blob: 96192db9687802c44ebd0c1b3c913ac4796c1043 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{
  This unit will grow to include all handy functions that can be used in
  different Lazarus projects.

  There may be no links to other non-standard units!
}
unit u_Tools;

{$mode objfpc}{$H+}

interface

  { Missing iif() known from Visual Basic - return a string }
  function  iif(fCon: Boolean; sTrue, sFalse: String): String;
  { Missing iif() known from Visual Basic - return an Integer }
  function  iif(fCon: Boolean; iTrue, iFalse: Integer): Integer;
  { Missing iif() known from Visual Basic - return an Extended }
  function  iif(fCon: Boolean; iTrue, iFalse: Extended): Extended;


implementation
uses
  SysUtils;


function iif(fCon: Boolean; sTrue, sFalse: String): String;
begin
  if fCon then
    Result := sTrue
  else
    Result := sFalse;
end;

function iif(fCon: Boolean; iTrue, iFalse: Integer): Integer;
begin
  if fCon then
    Result := iTrue
  else
    Result := iFalse;
end;

function iif(fCon: Boolean; iTrue, iFalse: Extended): Extended;
begin
  if fCon then
    Result := iTrue
  else
    Result := iFalse;
end;


end.