-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.arrays.pas
69 lines (57 loc) · 1.37 KB
/
utils.arrays.pas
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
unit Utils.Arrays;
{
Ollivier Civiol - 2019
https://ollivierciviolsoftware.wordpress.com/
}
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils;
type
TStringArray = Array of String;
TIntArray = Array of QWord;
TObjArray = Array of TObject;
TStreamArray = Array of TMemoryStream;
function InIntArray(value : QWord; const arr: TIntArray):Boolean; inline;
function InStringArray(const Value : String; arr : TStringArray):Boolean;
function GreateThanInIntArray(value : QWord; const arr: TIntArray):Boolean; inline;
function PosInIntArray(value : QWord; const arr: TIntArray):Integer; inline;
implementation
function InIntArray(value : QWord; const arr: TIntArray):Boolean; inline;
var
j : QWord;
begin
for j in Arr do
if value = j then
exit(True);
exit(false);
end;
function InStringArray(const Value : String; arr : TStringArray):Boolean;
var
s : string;
begin
for s in Arr do
if value.ToLower = s.ToLower then
exit(True);
exit(false);
end;
function PosInIntArray(value : QWord; const arr: TIntArray):Integer; inline;
var
i : integer;
begin
for i := low(arr) to high(arr) do
if value = arr[i] then
exit(i);
exit(-1);
end;
function GreateThanInIntArray(value : QWord; const arr: TIntArray):Boolean; inline;
var
j : QWord;
begin
for j in Arr do
if value > j then
exit(True);
exit(false);
end;
end.