C#提取文件名
来源:互联网 发布:比较骚的网络女主播 编辑:程序博客网 时间:2024/05/20 10:56
定义一个静态成员方法,该方法用于提取文件名。比如,给定一个字符串“c:\program files\Maths\all.dat”,使用该方法即可获取文件名all.dat。自行设计程序验证上述方法正确性。
public static string getFilename(string file)
{
//提示:主体中使用string类的indexof方法和substring方法
}
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { String Strfilme = @"c:\program files\Maths\all.dat"; Console.WriteLine(getFilename(Strfilme)); Console.ReadKey(); } public static string getFilename(string file) { return file.Substring(file.LastIndexOf('\\')+1); } }}
0 0
- C#提取文件名
- C#上机 第九周 任务1 用于提取文件名
- 批量提取文件名
- 提取文件夹下文件名
- dos 命令提取文件名
- bat 提取文件名
- 批量提取文件名
- 提取路径中的文件名
- [AHK]提取文件名
- shellscript 提取文件名
- 切分文件名提取文件扩展名或提取文件名
- Shell学习:切分文件名提取文件扩展名或提取文件名
- 切分文件名提取文件扩展名或提取文件名
- 切分文件名提取文件扩展名或提取文件名
- 关于提取文件名和路径
- 批量提取文件名的办法
- QFileInfo 的文件名提取问题
- Android路径中提取文件名
- 代码生成器 CodeSmith 的使用(六)
- va_start、va_arg、va_end、va_copy 可变参函数
- 程序猿如何从失恋中走出来
- Java NIO使用及原理分析(三)
- Gradient Boosting and GBDT
- C#提取文件名
- 驱动模块使用SPI总线范例
- Shell的基本语法
- hadoop安全模式
- 初学ssh之Spring 01
- HTTP Status 403 - Access to the requested resource has been denied
- Log4J基础详解及示例
- Socket ( Udp) 通信服务端
- 海思3515添加串口