-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathajstring.pas
executable file
·53 lines (40 loc) · 1.14 KB
/
ajstring.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
unit AJString;
interface
uses Objects;
(* Achtung: Die folgenden Funktionen funktionieren fr deutsche Umlaute nur
unter DOS richtig. Fr Windows muá der Quellcode angepaát werden. *)
function LowerCase(x: string): string; (* wandelt x in Kleinbuchstaben um *)
function UpperCase(x: string): string; (* wandelt x in Groábuchstaben um *)
function StrAlloc(Size: Word): PChar;
function StringValue(StrPtr: PString): string;
implementation
function LowerCase(x: string): string;
var
i: Byte;
y: array[Byte] of Byte absolute x;
begin
for i := 1 to y[0] do
if x[i] in ['A'..'Z', 'Ž', '™', 'š'] then y[i] := y[i] or $20;
LowerCase := x
end;
function UpperCase(x: string): string;
var
i: Byte;
y: array[Byte] of Byte absolute x;
begin
for i := 1 to y[0] do
if x[i] in ['a'..'z', '„', '”', ''] then y[i] := y[i] and not $20;
UpperCase := x
end;
function StrAlloc(Size: Word): PChar;
var P: PChar;
begin
GetMem(P, Size);
StrAlloc := P
end;
function StringValue(StrPtr: PString): string;
begin
if Assigned(StrPtr) then StringValue := StrPtr^
else StringValue := ''
end;
end.