Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,42 @@
$ include "seed7_05.s7i";
const func integer: commonLen (in array string: names, in char: sep) is func
result
var integer: result is -1;
local
var integer: index is 0;
var integer: pos is 1;
begin
if length(names) <> 0 then
repeat
for index range 1 to length(names) do
if pos > length(names[index]) or names[index][pos] <> names[1][pos] then
decr(pos);
while pos >= 1 and names[1][pos] <> sep do
decr(pos);
end while;
if pos > 1 then
decr(pos);
end if;
result := pos;
end if;
end for;
incr(pos);
until result <> -1;
end if;
end func;
const proc: main is func
local
var integer: length is 0;
const array string: names is [] ("/home/user1/tmp/coverage/test",
"/home/user1/tmp/covert/operator",
"/home/user1/tmp/coven/members")
begin
length := commonLen(names, '/');
if length = 0 then
writeln("No common path");
else
writeln("Common path: " <& names[1][.. length]);
end if;
end func;