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