我想分裂字符串.这是字符串.
string fileName = "description/ask_question_file_10.htm"
Run Code Online (Sandbox Code Playgroud)
我必须从此字符串中删除"description /"和".htm".所以结果我正在寻找"ask_question_file_10".我必须寻找"/"和".htm"我感谢任何帮助.
dtb*_*dtb 19
您可以使用Path.GetFileNameWithoutExtension方法:
string fileName = "description/ask_question_file_10.htm";
string result = Path.GetFileNameWithoutExtension(fileName);
// result == "ask_question_file_10"
Run Code Online (Sandbox Code Playgroud)
string fileName = Path.GetFileNameWithoutExtension("description/ask_question_file_10.htm")
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5064 次 |
| 最近记录: |