RosettaCodeData/Task/Find-common-directory-path/HicEst/find-common-directory-path.hicest
2023-07-01 13:44:08 -04:00

14 lines
446 B
Text

CHARACTER a='/home/user1/tmp/coverage/test', b='/home/user1/tmp/covert/operator', c='/home/user1/tmp/coven/members'
minLength = MIN( LEN(a), LEN(b), LEN(c) )
lastSlash = 0
DO i = 1, minLength
IF( (a(i) == b(i)) * (b(i) == c(i)) ) THEN
IF(a(i) == "/") lastSlash = i
ELSEIF( lastSlash ) THEN
WRITE(Messagebox) "Common Directory = ", a(1:lastSlash-1)
ELSE
WRITE(Messagebox, Name) "No common directory for", a, b, c
ENDIF
ENDDO