如何在最后'/'后得到字符串的值
string path=http://localhost:26952/Images/Users/John.jpg
Run Code Online (Sandbox Code Playgroud)
我希望得到类似的结果: John.jpg
Son*_*nül 12
我认为使用Path.GetFileName方法是一种更好的方式而不是字符串操作.
string path = "http://localhost:26952/Images/Users/John.jpg";
var result = Path.GetFileName(path);
Console.WriteLine(result); // John.jpg
Run Code Online (Sandbox Code Playgroud)