c# 4.0 - Return filename without extension from full path in C# -


this question has answer here:

i'm looking way return filename full path without extension.

    private static string returnfilenamewithoutextension(string varfullpathtofile) {         string filename = new fileinfo(varfullpathtofile).name;         string extension = new fileinfo(varfullpathtofile).extension;         return filename.replace(extension, "");        } 

is there more bullet proof solution replacing extension empty string?

return path.getfilenamewithoutextension (fullpath); 

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -