+ Added ex 48-66

This commit is contained in:
michael 1999-05-28 19:38:35 +00:00
parent 71e0799f74
commit 323bcde45d
22 changed files with 445 additions and 1 deletions

View File

@ -35,7 +35,10 @@ endif
OBJECTS=ex1 ex2 ex3 ex4 ex5 ex6 ex7 ex8 ex9 ex10 ex11 ex12\
ex13 ex14 ex15 ex16 ex17 ex18 ex19 ex20 ex21 ex22 ex23 ex24\
ex25 ex26 ex27 ex28 ex29 ex30 ex31 ex32 ex33 ex34 ex35 ex36\
ex37 ex38 ex39 ex40 ex41 ex42 ex43 ex44 ex45 ex46 ex47
ex37 ex38 ex39 ex40 ex41 ex42 ex43 ex44 ex45 ex46 ex47\
ex48 ex49 ex50 ex51 ex52 ex53 ex54 ex55 ex56 ex57 ex58\
ex59 ex60 ex61 ex62 ex63 ex64 ex65 ex66 ex67 ex68 ex68 ex70\
# ex1 ex2 ex3 ex4 ex5 ex6 ex7 ex8 ex9 ex10
TEXOBJECTS=$(addsuffix .tex, $(OBJECTS))

View File

@ -47,3 +47,23 @@ ex44.pp contains an example of the RenameFile function.
ex45.pp contains an example of the GetDirs function.
ex46.pp contains an example of the StrBufSize function.
ex47.pp contains an example of the SetDirSeparators function.
ex48.pp contains an example of the AdjustLineBreaks function.
ex49.pp contains an example of the AnsiCompareStr function.
ex50.pp contains an example of the AnsiCompareText function.
ex51.pp contains an example of the AnsiQuotedStr function.
ex52.pp contains an example of the AnsiLastChar function.
ex53.pp contains an example of the AnsiLowerCase function.
ex54.pp contains an example of the AnsiStrComp function.
ex55.pp contains an example of the AnsiStrIComp function.
ex56.pp contains an example of the AnsiStrLComp function.
ex57.pp contains an example of the AnsiStrLIComp function.
ex58.pp contains an example of the AnsiStrLastChar function.
ex59.pp contains an example of the AnsiStrLower function.
ex60.pp contains an example of the AnsiStrUpper function.
ex61.pp contains an example of the AnsiUpperCase function.
ex62.pp contains an example of the AppendStr function.
ex63.pp contains an example of the AssignStr function.
ex64.pp contains an example of the BCDToInt function.
ex65.pp contains an example of the CompareStr function.
ex66.pp contains an example of the CompareText function.
ex67.pp contains an example of the FloatToStr function.

13
docs/sysutex/ex48.pp Normal file
View File

@ -0,0 +1,13 @@
Program Example48;
{ This program demonstrates the AdjustLineBreaks function }
Uses sysutils;
Const
S = 'This is a string'#13'with embedded'#10'linefeed and'+
#13'CR characters';
Begin
Writeln (AdjustLineBreaks(S));
End.

29
docs/sysutex/ex49.pp Normal file
View File

@ -0,0 +1,29 @@
Program Example49;
{ This program demonstrates the AnsiCompareStr function }
{$H+}
Uses sysutils;
Procedure TestIt (S1,S2 : String);
Var R : Longint;
begin
R:=AnsiCompareStr(S1,S2);
Write ('"',S1,'" is ');
If R<0 then
write ('less than ')
else If R=0 then
Write ('equal to ')
else
Write ('larger than ');
Writeln ('"',S2,'"');
end;
Begin
Testit('One string','One smaller string');
Testit('One string','one string');
Testit('One string','One string');
Testit('One string','One tall string');
End.

29
docs/sysutex/ex50.pp Normal file
View File

@ -0,0 +1,29 @@
Program Example49;
{ This program demonstrates the AnsiCompareText function }
{$H+}
Uses sysutils;
Procedure TestIt (S1,S2 : String);
Var R : Longint;
begin
R:=AnsiCompareText(S1,S2);
Write ('"',S1,'" is ');
If R<0 then
write ('less than ')
else If R=0 then
Write ('equal to ')
else
Write ('larger than ');
Writeln ('"',S2,'"');
end;
Begin
Testit('One string','One smaller string');
Testit('One string','one string');
Testit('One string','One string');
Testit('One string','One tall string');
End.

14
docs/sysutex/ex51.pp Normal file
View File

@ -0,0 +1,14 @@
Program Example51;
{ This program demonstrates the AnsiQuotedStr function }
Uses sysutils;
Var S : AnsiString;
Begin
S:='He said "Hello" and walked on';
S:=AnsiQuotedStr(Pchar(S),'"');
Writeln (S);
Writeln(AnsiExtractQuotedStr(Pchar(S),'"'));
End.

15
docs/sysutex/ex52.pp Normal file
View File

@ -0,0 +1,15 @@
Program Example52;
{ This program demonstrates the AnsiLastChar function }
Uses sysutils;
Var S : AnsiString;
L : Longint;
Begin
S:='This is an ansistring.';
Writeln ('Last character of S is : ',AnsiLastChar(S));
L:=Longint(AnsiLastChar(S))-Longint(@S[1])+1;
Writeln ('Length of S is : ',L);
End.

17
docs/sysutex/ex53.pp Normal file
View File

@ -0,0 +1,17 @@
Program Example53;
{ This program demonstrates the AnsiLowerCase function }
Uses sysutils;
Procedure Testit (S : String);
begin
Writeln (S,' -> ',AnsiLowerCase(S))
end;
Begin
Testit('AN UPPERCASE STRING');
Testit('Some mixed STring');
Testit('a lowercase string');
End.

28
docs/sysutex/ex54.pp Normal file
View File

@ -0,0 +1,28 @@
Program Example54;
{ This program demonstrates the AnsiStrComp function }
Uses sysutils;
Procedure TestIt (S1,S2 : Pchar);
Var R : Longint;
begin
R:=AnsiStrComp(S1,S2);
Write ('"',S1,'" is ');
If R<0 then
write ('less than ')
else If R=0 then
Write ('equal to ')
else
Write ('larger than ');
Writeln ('"',S2,'"');
end;
Begin
Testit('One string','One smaller string');
Testit('One string','one string');
Testit('One string','One string');
Testit('One string','One tall string');
End.

28
docs/sysutex/ex55.pp Normal file
View File

@ -0,0 +1,28 @@
Program Example55;
{ This program demonstrates the AnsiStrIComp function }
Uses sysutils;
Procedure TestIt (S1,S2 : Pchar);
Var R : Longint;
begin
R:=AnsiStrIComp(S1,S2);
Write ('"',S1,'" is ');
If R<0 then
write ('less than ')
else If R=0 then
Write ('equal to ')
else
Write ('larger than ');
Writeln ('"',S2,'"');
end;
Begin
Testit('One string','One smaller string');
Testit('One string','one string');
Testit('One string','One string');
Testit('One string','One tall string');
End.

28
docs/sysutex/ex56.pp Normal file
View File

@ -0,0 +1,28 @@
Program Example56;
{ This program demonstrates the AnsiStrLComp function }
Uses sysutils;
Procedure TestIt (S1,S2 : Pchar; L : longint);
Var R : Longint;
begin
R:=AnsiStrLComp(S1,S2,L);
Write ('First ',L,' characters of "',S1,'" are ');
If R<0 then
write ('less than ')
else If R=0 then
Write ('equal to ')
else
Write ('larger than ');
Writeln ('those of "',S2,'"');
end;
Begin
Testit('One string','One smaller string',255);
Testit('One string','One String',4);
Testit('One string','1 string',0);
Testit('One string','One string.',9);
End.

28
docs/sysutex/ex57.pp Normal file
View File

@ -0,0 +1,28 @@
Program Example57;
{ This program demonstrates the AnsiStrLIComp function }
Uses sysutils;
Procedure TestIt (S1,S2 : Pchar; L : longint);
Var R : Longint;
begin
R:=AnsiStrLIComp(S1,S2,L);
Write ('First ',L,' characters of "',S1,'" are ');
If R<0 then
write ('less than ')
else If R=0 then
Write ('equal to ')
else
Write ('larger than ');
Writeln ('those of "',S2,'"');
end;
Begin
Testit('One string','One smaller string',255);
Testit('ONE STRING','one String',4);
Testit('One string','1 STRING',0);
Testit('One STRING','one string.',9);
End.

15
docs/sysutex/ex58.pp Normal file
View File

@ -0,0 +1,15 @@
Program Example58;
{ This program demonstrates the AnsiStrLastChar function }
Uses sysutils;
Var P : Pchar;
L : Longint;
Begin
P:='This is an PChar string.';
Writeln ('Last character of P is : ',AnsiStrLastChar(P));
L:=Longint(AnsiStrLastChar(P))-Longint(P)+1;
Writeln ('Length of P (',P,') is : ',L);
End.

17
docs/sysutex/ex59.pp Normal file
View File

@ -0,0 +1,17 @@
Program Example59;
{ This program demonstrates the AnsiStrLower function }
Uses sysutils;
Procedure Testit (S : Pchar);
begin
Writeln (S,' -> ',AnsiStrLower(S))
end;
Begin
Testit('AN UPPERCASE STRING');
Testit('Some mixed STring');
Testit('a lowercase string');
End.

17
docs/sysutex/ex60.pp Normal file
View File

@ -0,0 +1,17 @@
Program Example60;
{ This program demonstrates the AnsiStrUpper function }
Uses sysutils;
Procedure Testit (S : Pchar);
begin
Writeln (S,' -> ',AnsiStrUpper(S))
end;
Begin
Testit('AN UPPERCASE STRING');
Testit('Some mixed STring');
Testit('a lowercase string');
End.

17
docs/sysutex/ex61.pp Normal file
View File

@ -0,0 +1,17 @@
Program Example60;
{ This program demonstrates the AnsiUpperCase function }
Uses sysutils;
Procedure Testit (S : String);
begin
Writeln (S,' -> ',AnsiUpperCase(S))
end;
Begin
Testit('AN UPPERCASE STRING');
Testit('Some mixed STring');
Testit('a lowercase string');
End.

13
docs/sysutex/ex62.pp Normal file
View File

@ -0,0 +1,13 @@
Program Example62;
{ This program demonstrates the AppendStr function }
Uses sysutils;
Var S : AnsiString;
Begin
S:='This is an ';
AppendStr(S,'AnsiString');
Writeln ('S = "',S,'"');
End.

16
docs/sysutex/ex63.pp Normal file
View File

@ -0,0 +1,16 @@
Program Example63;
{ This program demonstrates the AssignStr function }
{$H+}
Uses sysutils;
Var P : PString;
Begin
P:=NewStr('A first AnsiString');
Writeln ('Before: P = "',P^,'"');
AssignStr(P,'A Second ansistring');
Writeln ('After : P = "',P^,'"');
DisposeStr(P);
End.

16
docs/sysutex/ex64.pp Normal file
View File

@ -0,0 +1,16 @@
Program Example64;
{ This program demonstrates the BCDToInt function }
Uses sysutils;
Procedure Testit ( L : longint);
begin
Writeln (L,' -> ',BCDToInt(L));
end;
Begin
Testit(10);
Testit(100);
Testit(1000);
End.

29
docs/sysutex/ex65.pp Normal file
View File

@ -0,0 +1,29 @@
Program Example65;
{ This program demonstrates the CompareStr function }
{$H+}
Uses sysutils;
Procedure TestIt (S1,S2 : String);
Var R : Longint;
begin
R:=CompareStr(S1,S2);
Write ('"',S1,'" is ');
If R<0 then
write ('less than ')
else If R=0 then
Write ('equal to ')
else
Write ('larger than ');
Writeln ('"',S2,'"');
end;
Begin
Testit('One string','One smaller string');
Testit('One string','one string');
Testit('One string','One string');
Testit('One string','One tall string');
End.

29
docs/sysutex/ex66.pp Normal file
View File

@ -0,0 +1,29 @@
Program Example66;
{ This program demonstrates the CompareText function }
{$H+}
Uses sysutils;
Procedure TestIt (S1,S2 : String);
Var R : Longint;
begin
R:=CompareText(S1,S2);
Write ('"',S1,'" is ');
If R<0 then
write ('less than ')
else If R=0 then
Write ('equal to ')
else
Write ('larger than ');
Writeln ('"',S2,'"');
end;
Begin
Testit('One string','One smaller string');
Testit('One string','one string');
Testit('One string','One string');
Testit('One string','One tall string');
End.

23
docs/sysutex/ex67.pp Normal file
View File

@ -0,0 +1,23 @@
Program Example67;
{ This program demonstrates the FloatToStr function }
Uses sysutils;
Procedure Testit (Value : Extended);
begin
Writeln (Value,' -> ',FloatToStr(Value));
Writeln (-Value,' -> ',FloatToStr(-Value));
end;
Begin
Testit (0.0);
Testit (1.1);
Testit (1.1e-3);
Testit (1.1e-20);
Testit (1.1e-200);
Testit (1.1e+3);
Testit (1.1e+20);
Testit (1.1e+200);
End.