home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GEMini Atari
/
GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso
/
files
/
bbs
/
pibterm
/
pibt3sp1
/
copystoa.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1985-08-11
|
4KB
|
87 lines
(*--------------------------------------------------------------------------*)
(* CopyStoA -- Copy string to character array *)
(*--------------------------------------------------------------------------*)
PROCEDURE CopyStoA( S : AnyStr; VAR A ; Length_A : INTEGER );
(*--------------------------------------------------------------------------*)
(* *)
(* Procedure: CopyStoA *)
(* *)
(* Purpose: Copies string to character array, blank fill *)
(* *)
(* Calling Sequence: *)
(* *)
(* CopyStoA( S : AnyStr; VAR A ; Length_A: INTEGER ); *)
(* *)
(* S --- String to be copied *)
(* A --- Character array to be copied into *)
(* Length_A --- No. of characters in A *)
(* *)
(* Calls: None *)
(* *)
(*--------------------------------------------------------------------------*)
VAR
I : INTEGER;
AA : PACKED ARRAY[ 1 .. 1 ] OF CHAR ABSOLUTE A;
BEGIN (* CopyStoA *)
FOR I := 1 TO MIN( Length_A , LENGTH( S ) ) DO
AA[I] := S[I];
FOR I := ( I + 1 ) TO Length_A DO
AA[I] := ' ';
END (* CopyStoA *);
(*--------------------------------------------------------------------------*)
(* CopyS2AR -- Copy string to character array, right adjust *)
(*--------------------------------------------------------------------------*)
PROCEDURE CopyS2AR( S : AnyStr; VAR A ; Length_A : INTEGER );
(*--------------------------------------------------------------------------*)
(* *)
(* Procedure: CopyS2AR *)
(* *)
(* Purpose: Copies string to character array, blank fill on left *)
(* *)
(* Calling Sequence: *)
(* *)
(* CopyS2AR( S : AnyStr; VAR A ; Length_A: INTEGER ); *)
(* *)
(* S --- String to be copied *)
(* A --- Character array to be copied into *)
(* Length_A --- No. of characters in A *)
(* *)
(* Calls: None *)
(* *)
(*--------------------------------------------------------------------------*)
VAR
I : INTEGER;
Len_S : INTEGER;
Len_A : INTEGER;
L : INTEGER;
AA : PACKED ARRAY[ 1 .. 1 ] OF CHAR ABSOLUTE A;
BEGIN (* CopyS2AR *)
Len_S := LENGTH( S );
Len_A := Length_A;
L := MIN( Len_A , Len_S );
FOR I := 1 TO L DO
BEGIN
AA[Len_A] := S[Len_S];
Len_A := Len_A - 1;
Len_S := Len_S - 1;
END;
FOR I := Len_A DOWNTO 1 DO
AA[I] := ' ';
END (* CopyS2AR *);
ə