分解路径为目录名和文件名的方法
来源:互联网 发布:linux grub2 修复 编辑:程序博客网 时间:2024/05/22 07:43
using System;
class Test
{
static void SplitPath(string path,out string dir,out string name)
{
int i = path.Length;
while (i > 0)
{
char ch = path[i-1];
if (ch == '\\' || ch == '/' || ch == ':')
break;
i--;
}
dir = path.Substring(0,i);
name = path.Substring(i);
}
static void Main()
{
string dir, name;
SplitPath("c:\\windows\\system\\hello.txt",out dir,out name);
Console.WriteLine("目录名:{0}",dir);
Console.WriteLine("文件名:{0}",name);
}
}
0 0
- 分解路径为目录名和文件名的方法
- linux_取得路径文件名和目录名
- Linux的shell提取文件名和目录名的方法
- linux提取文件名和目录名的方法
- Bash Shell 解析路径获取文件名和目录名
- 通过系统调用basename(), dirname()得到当前路径下的文件名和目录名
- linux shell获取路径的文件名及其目录名
- 绝对路径分割为目录路径和文件名(VB)
- 让tomcat支持中文路径名和中文文件名的方法
- Linux shell 之 提取文件名和目录名的一些方法
- Linux shell中提取文件名和目录名的一些方法
- Linux shell 之 提取文件名和目录名的一些方法
- Linux shell 之 提取文件名和目录名的一些方法
- Linux shell 之 提取文件名和目录名的一些方法
- Linux shell 之 提取文件名和目录名的一些方法
- Linux shell 之 提取文件名和目录名的一些方法
- Linux shell 之 提取文件名和目录名的一些方法
- Linux shell 之 提取文件名和目录名的一些方法
- 【Python】按行读取文件、IOError: [Errno 22] invalid mode ('a+') or filename,处理文件的换行符
- 未解——Matlab solve函数
- 如何用4M网速为30个程序猿提供特殊服务
- findbugs类介绍(BetterVisitor)
- 数据库管理(12)
- 分解路径为目录名和文件名的方法
- git merge.tool
- 数据结构——单链表(链表操作算法集合)
- myeclipse集成jdk、tomcat8、maven、svn
- intent Getting java.lang.SecurityException: Unable to find app for caller android.app.ApplicationThr
- 数据库管理(12)
- 点滴0
- 有趣的机器学习
- 从头开始写项目Makefile(八):模式规则 .