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
Post a Comment