RosettaCodeData/Task/Find-common-directory-path/00-TASK.txt

15 lines
820 B
Plaintext

Create a routine that, given a set of strings representing directory paths and a single character directory separator, will return a string representing that part of the directory tree that is common to all the directories.
Test your routine using the forward slash '/' character as the directory separator and the following three strings as input paths:
'/home/user1/tmp/coverage/test'
'/home/user1/tmp/covert/operator'
'/home/user1/tmp/coven/members'
Note: The resultant path should be the valid directory <code>'/home/user1/tmp'</code> and not the longest common string <code>'/home/user1/tmp/cove'</code>.
If your language has a routine that performs this function (even if it does not have a changeable separator character), then mention it as part of the task.
{{Template:Strings}}
<br><br>