c# - How can I split a string to obtain a filename? -


i trying split string. here string.

string filename =   "description/ask_question_file_10.htm" 

i have remove "description/" , ".htm" string. result looking "ask_question_file_10". have "/" , ".htm" appreciate help.

you can use path.getfilenamewithoutextension method:

string filename = "description/ask_question_file_10.htm";  string result = path.getfilenamewithoutextension(filename); // result == "ask_question_file_10" 

Comments

Popular posts from this blog

Python __call__ special method practical example -

How can I edit my VIM config so that Vim treats ".ejs" files the same as it currently treats my html files? -