home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 2
/
ctrom_ii_b.zip
/
ctrom_ii_b
/
PROGRAM
/
PASCAL
/
TCSEL002
/
ASC2STR.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-10-19
|
626b
|
13 lines
function Asc2Str(var s; max: byte): string;
{ Converts an ASCIIZ string to a Turbo Pascal string }
{ with a maximum length of max. }
var starray : array[1..255] of char absolute s;
len : integer;
begin
len := pos(#0,starray)-1; { Get the length }
if (len > max) or (len < 0) then { length exceeds maximum }
len := max; { so set to maximum }
Asc2Str := starray;
Asc2Str[0] := chr(len); { Set length }
end; { Asc2Str }