Get Path From Full Path - CSharp System.IO

CSharp examples for System.IO:File Path

Description

Get Path From Full Path

Demo Code


using System.Text;
using System.IO;// w w w  .j  av  a  2s.  c  o m
using System.Globalization;
using System.Collections.Generic;
using System;

public class Main{
        public static string GetPathFromFullPath(string fullPath)
        {
            return !fullPath.Contains("\\") ? Directory.GetCurrentDirectory() :
                fullPath.Substring(0, fullPath.LastIndexOf("\\") + 1);
        }
}

Related Tutorials