开发者

Split function; discard all data before the last instance of a delimiter

开发者 https://www.devze.com 2023-01-27 03:35 出处:网络
Okay so what I\'m trying to do is get the filename from OpenFileDialog/SaveFileDialog, only without the full path, and dump said filename into a variable so I can use it for 开发者_如何学编程other thi

Okay so what I'm trying to do is get the filename from OpenFileDialog/SaveFileDialog, only without the full path, and dump said filename into a variable so I can use it for 开发者_如何学编程other things.

Using the Split function, I can get any part of the array between the delimiters ("\"), but what I'm trying to do is get all the information after the LAST delimiter in the string.


You could use Path.GetFileName to get the file name.


Why not convert this to a Fileinfo object and pull the name property?

(MSDN Link)

0

精彩评论

暂无评论...
验证码 换一张
取 消