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

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

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

The canvas has been tainted by cross-origin data in chrome only -