Get file name from path string : File Info « File Stream « C# / C Sharp
- C# / C Sharp
- File Stream
- File Info
Get file name from path string
using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
public class Utils
{
public static string GetFilename(string pathFilename)
{
string rc = pathFilename;
int start = pathFilename.LastIndexOf('\\');
if ((start > -1) && ((start + 1) < pathFilename.Length))
rc = pathFilename.Substring(start + 1);
return rc;
}
}
Related examples in the same category