Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,31 @@
|
|||
$ include "seed7_05.s7i";
|
||||
|
||||
const func string: stripComment (in string: line) is func
|
||||
result
|
||||
var string: lineWithoutComment is "";
|
||||
local
|
||||
var integer: lineEnd is 0;
|
||||
var integer: pos is 0;
|
||||
begin
|
||||
lineEnd := length(line);
|
||||
for pos range 1 to length(line) do
|
||||
if line[pos] in {'#', ';'} then
|
||||
lineEnd := pred(pos);
|
||||
pos := length(line);
|
||||
end if;
|
||||
end for;
|
||||
lineWithoutComment := line[.. lineEnd];
|
||||
end func;
|
||||
|
||||
const proc: main is func
|
||||
local
|
||||
var string: stri is "apples, pears # and bananas\n\
|
||||
\apples, pears ; and bananas";
|
||||
var string: line is ""
|
||||
begin
|
||||
writeln(stri);
|
||||
writeln("====>");
|
||||
for line range split(stri, '\n') do
|
||||
writeln(stripComment(line));
|
||||
end for;
|
||||
end func;
|
||||
Loading…
Add table
Add a link
Reference in a new issue