home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
pascal
/
library
/
dos
/
strings
/
strfunc
/
strdemo.pas
next >
Wrap
Pascal/Delphi Source File
|
1988-01-19
|
2KB
|
58 lines
Program StrDemo;
Uses Dos,Crt,StrFunct;
{$V-}
Var
Name1 : String;
OrigColor : Byte;
I : Integer;
Num1 : Real;
Begin
ClrScr;
OrigColor:= TextAttr;
TextBackGround(7);
TextColor(0);
Name1:= '';
Name1:= ' Johnny';
GotoXY(10,2); Write('First Strings');
GotoXY(5,4); Write('Column Markers');
GotoXY(45,4); Write('12345678901234567890');
GotoXY(5,5); Write('Original String =');
GotoXY(45,5); Write(Name1);
GotoXY(5,6); Write('Left justified, field size 12:');
Name1:= Left(Name1,12,#32);
GotoXY(45,6); Write(Name1);
GotoXY(5,7); Write('Right justified, field size 12:');
Name1:= Right(Name1,12,#32);
GotoXY(45,7); Write(Name1);
GotoXY(5,9); Write('New string? (extra spaces ok) ');
Name1:= ' iSn''t THIS gREAT fun?';
GotoXY(45,9); Write(Name1);
I:= Words(Name1);
GotoXY(45,10); Write('# of words in string = ',I);
Name1:= Normalize(Name1);
GotoXY(5,11); Write('Normalized string =');
GotoXY(45,11); Write(Name1);
Name1:= OneCap(Name1);
GotoXY(5,12); Write('Now in OneCap form =');
GotoXY(45,12); Write(Name1);
Name1:= FirstCap(Name1);
GotoXY(5,13); Write('Now in FirstCap form =');
GotoXY(45,13); Write(Name1);
Name1:= AllCap(Name1);
GotoXY(5,14); Write('Now in AllCap form =');
GotoXY(45,14); Write(Name1);
Num1:= 1234.55;
GotoXY(10,16); Write('Now a Real Number:');
GotoXY(5,18); Write('Original number =');
GotoXY(55,18); Write(Num1:1:2);
GotoXY(5,19); Write('Dollar form, right justified, field 12:');
Name1:= Right(Comma('$',Num1,10,2),12,#32);
GotoXY(55,19); Write(Name1);
Name1:= Right(Comma('#',Num1,10,2),12,#32);
GotoXY(5,20); Write('Punctuated form, right justified, field 12:');
GotoXY(55,20); Write(Name1);
Name1:= Right(Comma('%',Num1,10,2),12,#32);
GotoXY(5,21); Write('Percent form, right justified, field 12:');
GotoXY(55,21); Write(Name1);
TextAttr:= OrigColor;
End.