filenames - How to separate the file name and the extension of a file in c# -


this question has answer here:

is possible separate name of file it's file type/ file extension.

for example have file named sample.text. want separate sample , .txt using c#.

can me. thanks.

you can use path.getextension:

var extension =      path.getextension("c:\\sample.txt"); // returns txt 

..and path.getfilenamewithoutextension:

var filenamewithoutextension =      path.getfilenamewithoutextension("c:\\sample.txt"); // returns sample 

Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c# - Avoiding duplicate methods for Task and Task<T> -

javascript - Which segment of a polyline was clicked? -