mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-11 11:29:29 +02:00
+ Added last examples
This commit is contained in:
parent
2726b9d130
commit
a1fede8c2a
@ -38,9 +38,8 @@ OBJECTS=ex1 ex2 ex3 ex4 ex5 ex6 ex7 ex8 ex9 ex10 ex11 ex12\
|
||||
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 ex69 ex70\
|
||||
ex71 ex72 ex73 ex74
|
||||
#ex75 ex76 ex77 ex78 ex79 ex80
|
||||
# ex2 ex3 ex4 ex5 ex6 ex7 ex8 ex9 ex10
|
||||
ex71 ex72 ex73 ex74 ex75 ex76 ex77 ex78 ex79 ex80 \
|
||||
ex81 ex82 ex83 ex84 ex85 ex86 ex87
|
||||
|
||||
TEXOBJECTS=$(addsuffix .tex, $(OBJECTS))
|
||||
|
||||
|
@ -74,3 +74,16 @@ ex71.pp contains an example of the Format function.
|
||||
ex71.pp contains an example of the FormatBuf function.
|
||||
ex73.pp contains an example of the IntToHex function.
|
||||
ex74.pp contains an example of the IntToStr function.
|
||||
ex75.pp contains an example of the IsValidIdent function.
|
||||
ex76.pp contains an example of the LeftStr function.
|
||||
ex77.pp contains an example of the LowerCase function.
|
||||
ex78.pp contains an example of the QuotedStr function.
|
||||
ex79.pp contains an example of the RightStr function.
|
||||
ex80.pp contains an example of the StrFmt function.
|
||||
ex81.pp contains an example of the StrLFmt function.
|
||||
ex82.pp contains an example of the StrToInt function.
|
||||
ex83.pp contains an example of the StrToIntDef function.
|
||||
ex84.pp contains an example of the Trim function.
|
||||
ex85.pp contains an example of the TrimLeft function.
|
||||
ex86.pp contains an example of the TrimRight function.
|
||||
ex87.pp contains an example of the UpperCase function.
|
||||
|
23
docs/sysutex/ex75.pp
Normal file
23
docs/sysutex/ex75.pp
Normal file
@ -0,0 +1,23 @@
|
||||
Program Example75;
|
||||
|
||||
{ This program demonstrates the IsValidIdent function }
|
||||
|
||||
Uses sysutils;
|
||||
|
||||
Procedure Testit (S : String);
|
||||
|
||||
begin
|
||||
Write ('"',S,'" is ');
|
||||
If not IsVAlidIdent(S) then
|
||||
Write('NOT ');
|
||||
Writeln ('a valid identifier');
|
||||
end;
|
||||
|
||||
Begin
|
||||
Testit ('_MyObj');
|
||||
Testit ('My__Obj1');
|
||||
Testit ('My_1_Obj');
|
||||
Testit ('1MyObject');
|
||||
Testit ('My@Object');
|
||||
Testit ('M123');
|
||||
End.
|
12
docs/sysutex/ex76.pp
Normal file
12
docs/sysutex/ex76.pp
Normal file
@ -0,0 +1,12 @@
|
||||
Program Example76;
|
||||
|
||||
{ This program demonstrates the LeftStr function }
|
||||
|
||||
Uses sysutils;
|
||||
|
||||
Begin
|
||||
Writeln (LeftStr('abcdefghijklmnopqrstuvwxyz',20));
|
||||
Writeln (LeftStr('abcdefghijklmnopqrstuvwxyz',15));
|
||||
Writeln (LeftStr('abcdefghijklmnopqrstuvwxyz',1));
|
||||
Writeln (LeftStr('abcdefghijklmnopqrstuvwxyz',200));
|
||||
End.
|
9
docs/sysutex/ex77.pp
Normal file
9
docs/sysutex/ex77.pp
Normal file
@ -0,0 +1,9 @@
|
||||
Program Example77;
|
||||
|
||||
{ This program demonstrates the LowerCase function }
|
||||
|
||||
Uses sysutils;
|
||||
|
||||
Begin
|
||||
Writeln (LowerCase('THIS WILL COME out all LoWeRcAsE !'));
|
||||
End.
|
14
docs/sysutex/ex78.pp
Normal file
14
docs/sysutex/ex78.pp
Normal file
@ -0,0 +1,14 @@
|
||||
Program Example78;
|
||||
|
||||
{ This program demonstrates the QuotedStr function }
|
||||
|
||||
Uses sysutils;
|
||||
|
||||
Var S : AnsiString;
|
||||
|
||||
Begin
|
||||
S:='He said ''Hello'' and walked on';
|
||||
Writeln (S);
|
||||
Writeln (' becomes');
|
||||
Writeln (QuotedStr(S));
|
||||
End.
|
12
docs/sysutex/ex79.pp
Normal file
12
docs/sysutex/ex79.pp
Normal file
@ -0,0 +1,12 @@
|
||||
Program Example79;
|
||||
|
||||
{ This program demonstrates the RightStr function }
|
||||
|
||||
Uses sysutils;
|
||||
|
||||
Begin
|
||||
Writeln (RightStr('abcdefghijklmnopqrstuvwxyz',20));
|
||||
Writeln (RightStr('abcdefghijklmnopqrstuvwxyz',15));
|
||||
Writeln (RightStr('abcdefghijklmnopqrstuvwxyz',1));
|
||||
Writeln (RightStr('abcdefghijklmnopqrstuvwxyz',200));
|
||||
End.
|
12
docs/sysutex/ex80.pp
Normal file
12
docs/sysutex/ex80.pp
Normal file
@ -0,0 +1,12 @@
|
||||
Program Example80;
|
||||
|
||||
{ This program demonstrates the StrFmt function }
|
||||
|
||||
Uses sysutils;
|
||||
|
||||
Var S : AnsiString;
|
||||
|
||||
Begin
|
||||
SetLEngth(S,80);
|
||||
Writeln (StrFmt (@S[1],'For some nice examples of fomatting see %s.',['Format']));
|
||||
End.
|
12
docs/sysutex/ex81.pp
Normal file
12
docs/sysutex/ex81.pp
Normal file
@ -0,0 +1,12 @@
|
||||
Program Example80;
|
||||
|
||||
{ This program demonstrates the StrFmt function }
|
||||
|
||||
Uses sysutils;
|
||||
|
||||
Var S : AnsiString;
|
||||
|
||||
Begin
|
||||
SetLEngth(S,80);
|
||||
Writeln (StrLFmt (@S[1],80,'For some nice examples of fomatting see %s.',['Format']));
|
||||
End.
|
17
docs/sysutex/ex82.pp
Normal file
17
docs/sysutex/ex82.pp
Normal file
@ -0,0 +1,17 @@
|
||||
Program Example82;
|
||||
|
||||
{ This program demonstrates the StrToInt function }
|
||||
|
||||
Uses sysutils;
|
||||
|
||||
Begin
|
||||
Writeln (StrToInt('1234'));
|
||||
Writeln (StrToInt('-1234'));
|
||||
Writeln (StrToInt('0'));
|
||||
Try
|
||||
Writeln (StrToInt('12345678901234567890'));
|
||||
except
|
||||
On E : EConvertError do
|
||||
Writeln ('Invalid number encountered');
|
||||
end;
|
||||
End.
|
17
docs/sysutex/ex83.pp
Normal file
17
docs/sysutex/ex83.pp
Normal file
@ -0,0 +1,17 @@
|
||||
Program Example82;
|
||||
|
||||
{ This program demonstrates the StrToInt function }
|
||||
|
||||
Uses sysutils;
|
||||
|
||||
Begin
|
||||
Writeln (StrToIntDef('1234',0));
|
||||
Writeln (StrToIntDef('-1234',0));
|
||||
Writeln (StrToIntDef('0',0));
|
||||
Try
|
||||
Writeln (StrToIntDef('12345678901234567890',0));
|
||||
except
|
||||
On E : EConvertError do
|
||||
Writeln ('Invalid number encountered');
|
||||
end;
|
||||
End.
|
18
docs/sysutex/ex84.pp
Normal file
18
docs/sysutex/ex84.pp
Normal file
@ -0,0 +1,18 @@
|
||||
Program Example84;
|
||||
|
||||
{ This program demonstrates the Trim function }
|
||||
|
||||
Uses sysutils;
|
||||
{$H+}
|
||||
|
||||
Procedure Testit (S : String);
|
||||
|
||||
begin
|
||||
Writeln ('"',Trim(S),'"');
|
||||
end;
|
||||
|
||||
Begin
|
||||
Testit (' ha ha what gets lost ? ');
|
||||
Testit (#10#13'haha ');
|
||||
Testit (' ');
|
||||
End.
|
18
docs/sysutex/ex85.pp
Normal file
18
docs/sysutex/ex85.pp
Normal file
@ -0,0 +1,18 @@
|
||||
Program Example85;
|
||||
|
||||
{ This program demonstrates the TrimLeft function }
|
||||
|
||||
Uses sysutils;
|
||||
{$H+}
|
||||
|
||||
Procedure Testit (S : String);
|
||||
|
||||
begin
|
||||
Writeln ('"',TrimLeft(S),'"');
|
||||
end;
|
||||
|
||||
Begin
|
||||
Testit (' ha ha what gets lost ? ');
|
||||
Testit (#10#13'haha ');
|
||||
Testit (' ');
|
||||
End.
|
18
docs/sysutex/ex86.pp
Normal file
18
docs/sysutex/ex86.pp
Normal file
@ -0,0 +1,18 @@
|
||||
Program Example86;
|
||||
|
||||
{ This program demonstrates the TrimRight function }
|
||||
|
||||
Uses sysutils;
|
||||
{$H+}
|
||||
|
||||
Procedure Testit (S : String);
|
||||
|
||||
begin
|
||||
Writeln ('"',TrimRight(S),'"');
|
||||
end;
|
||||
|
||||
Begin
|
||||
Testit (' ha ha what gets lost ? ');
|
||||
Testit (#10#13'haha ');
|
||||
Testit (' ');
|
||||
End.
|
9
docs/sysutex/ex87.pp
Normal file
9
docs/sysutex/ex87.pp
Normal file
@ -0,0 +1,9 @@
|
||||
Program Example87;
|
||||
|
||||
{ This program demonstrates the UpperCase function }
|
||||
|
||||
Uses sysutils;
|
||||
|
||||
Begin
|
||||
Writeln (UpperCase('this will come OUT ALL uPpErCaSe !'));
|
||||
End.
|
Loading…
Reference in New Issue
Block a user