Find common directory path: Difference between revisions

easylang
m (Undo revision 344180 by Walterpachl (talk) "Correction" produced incorrect output.)
Tag: Undo
(easylang)
Line 750:
{{out}}
<pre>/home/user1/tmp</pre>
 
=={{header|EasyLang}}==
{{trans|AWK}}
 
<syntaxhighlight lang=easylang>
func$ comdir path$[] .
for i = 1 to len path$[1]
c$ = substr path$[1] i 1
for j = 2 to len path$[]
if c$ <> substr path$[j] i 1
break 2
.
.
if c$ = "/"
f = i - 1
.
.
return substr path$[1] 1 f
.
a$[] &= "/home/user1/tmp/coverage/test"
a$[] &= "/home/user1/tmp/covert/operator"
a$[] &= "/home/user1/tmp/coven/members"
print comdir a$[]
</syntaxhighlight>
 
=={{header|Elixir}}==
2,054

edits