I have two paths: ‘C:\ol\il\ek’ and ‘ek\mek\gr’. How can i cut the common part from these paths? I’m making one paths from them like that (h- first path, n – second path):
ee.Load(h + "\\" + n);
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Assuming the “common part” is always the last segment of the first path, and the first segment of the second one, you can use Path.GetDirectoryName to strip this segment from the first path and combine the result with the second path using Path.Combine: