UNIX Free Pascal


. - 7


var

s:string;

n:byte;

er:integer;

t:text;

begin

if paramcount<>2 then begin

writeln('mycut n _');

exit

end;

s:=paramstr(1);

val(s,n,er);

if er<>0 then begin

writeln('error n ');

exit

end;

s:=paramstr(2);

assign(t,s);

reset(t);

while not eof(t) do

begin

readln(t,s);

if n>length(s) then writeln('')

else begin

s:=copy(s,n,length(s));

writeln(s);

end;

end;

close(t);

end.

 

13.14. , , , .

function isdigit(c:char):boolean;

begin

isdigit:=c in ['0'..'9'];

end;

 

function isalpha(c:char):boolean;

begin

isalpha:=(c in ['a'..'z']) or (c in ['A'..'Z']) or (c in [''..'']) or (c in [''..'']);

end;

 

 

function convertor(s:string):string;

var

i:integer;

const

res:string='';

begin

for i:=1 to byte(s[0]) do

if isdigit(s[i]) then

res:=res+s[i]+#8+s[i]

else

if isalpha(s[i]) then

res:=res+s[i]+#8+'_'

else

res:=res+s[i];

convertor:=res;

end;

 

begin

writeln(convertor('11 2001 . - ( 2003 .)'));

end.

 

13.15. expand(s1, s2), a-z s1 abcd...xyz s2. . a-b-c, a-z0-9 -a-g ( , "-", , ).

program demoexpand;

function ex(s1:string; var s2:string):boolean;

var

i:byte;

begin

s2:='';

if (((((s1[1]>='0')and(s1[1]<='9'))and((s1[3]>='0')and(s1[3]<='9')))




- -  - -  - -