RosettaCodeData/Task/FASTA-format/Seed7/fasta-format.seed7

28 lines
625 B
Plaintext

$ include "seed7_05.s7i";
const proc: main is func
local
var file: fastaFile is STD_NULL;
var string: line is "";
var boolean: first is TRUE;
begin
fastaFile := open("fasta_format.in", "r");
if fastaFile <> STD_NULL then
while hasNext(fastaFile) do
line := getln(fastaFile);
if startsWith(line, ">") then
if first then
first := FALSE;
else
writeln;
end if;
write(line[2 ..] <& ": ");
else
write(line);
end if;
end while;
close(fastaFile);
end if;
writeln;
end func;