using System;
using System.IO;
namespace SystemIoStudy
{
internal class Program
{
static void Main(string[] args)
{
var filePath = @"F:\book\001SQL优化.pdf";
Console.WriteLine(Path.GetFileName(filePath));
var imagePath = "https://c-ssl.dtstatic.com/uploads/blog/202108/22/20210822070705_cfd6b.thumb.1000_0.jpg";
Console.WriteLine(Path.GetFileName(imagePath));
Path.GetFileNameWithoutExtension(filePath);
Console.WriteLine(Path.GetExtension(filePath));
var fileInfo = new FileInfo(filePath);
Console.WriteLine(fileInfo.Directory.Name);
Console.WriteLine(fileInfo.Directory.FullName);
Console.WriteLine(Path.Combine(fileInfo.Directory.FullName, Path.GetFileName(imagePath)));
Console.WriteLine(Path.IsPathRooted(filePath));
Console.WriteLine(Path.IsPathRooted("book/aa.jpg"));
Console.WriteLine(Path.IsPathRooted("/book/aa.jpg"));
Console.ReadKey();
}
}
}