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

17 lines
461 B
Text

Public Sub Main()
Dim sFolder As String[] = ["/home/user1/tmp/coverage/test", "/home/user1/tmp/covert/operator", "/home/user1/tmp/coven/members"]
Dim sSame As String
Dim siCount As Short = 1
Do
If Mid(sFolder[0], siCount, 1) = Mid(sFolder[1], siCount, 1) And Mid(sFolder[0], siCount, 1) = Mid(sFolder[2], siCount, 1) Then
sSame &= Mid(sFolder[0], siCount, 1)
Else
Break
End If
Inc siCount
Loop
Print Mid(sSame, 1, RInStr(sSame, "/") - 1)
End