开发者

How to get filename from a file "template.docx.amp" in c#?

开发者 https://www.devze.com 2023-01-04 21:32 出处:网络
I have got a strange template whose extension is \".docx.amp\" . Now i want to get fileName. i.e \"开发者_如何学Ctemplate\". Path.GetFileNameWithoutExtension() fails as it returns template.docx. Is th

I have got a strange template whose extension is ".docx.amp" . Now i want to get fileName. i.e "开发者_如何学Ctemplate". Path.GetFileNameWithoutExtension() fails as it returns template.docx. Is there any other built in mechanism or i will have to go the ugle string comparison/split way. Please suggest and give some workaround


Nope, you will have to use some kind of string split, eg:

var nameWithoutExtension = filename.Split('.')[0];
0

精彩评论

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

关注公众号