/// <summary>
/// Returns just the filename excluding the extention. Option to include extention.
/// Put any string in second argument. Could use Path.GetFileName() instead.
/// </summary>
/// <param name="file"></param>
/// <returns></returns>
public static string CutOutFilename(string file)
{
string filename= "";
int start= file.LastIndexOf(.);
file= file.Remove(start, file.Length - start);
start= file.LastIndexOf("\\");
filename= file.Substring(start+1);
return filename;
}
//----------
public static string CutOutFilename(string file, string IncludeExt_) //change IncludeExt_ to bool would be better.
{
string filename= "";
int start= file.LastIndexOf("\\");
filename= file.Substring(start+1);
return filename;
}