当前位置:网站首页>分解路径为目录名和文件名的方法
分解路径为目录名和文件名的方法
2022-07-28 05:29:00 【angleoldhen】
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);
}
}
边栏推荐
- MOOC翁恺 C语言 第三周:判断与循环:1.判断
- Repair the faulty sector
- 360 compatibility issues
- [learning records of erudite Valley] Super summary, attentive sharing | collection
- DOM Foundation
- Ubuntu18.04 set up redis cluster [learning notes]
- [learning notes] process creation
- Technology sharing | how to simulate real use scenarios? Mock technology to help you
- NAT和PAT的原理及配置
- YUM仓库的搭建
猜你喜欢

MOOC Weng Kai C language week 8: pointer and string: 1. Pointer 2. Character type 3. String 4. String calculation

Shell script -- program conditional statements (conditional tests, if statements, case branch statements, echo usage, for loops, while loops)

Network - transport layer (detailed version)

DNS domain name resolution

Custom component -- data listener

DNS域名解析

Icc2 analysis timing artifact analyze_ design_ violations

DOM Foundation

Custom components -- slots

JSON notes
随机推荐
DOM operation cases
PXE无人值守安装管理
[learning notes] process creation
MOOC翁恺C语言第八周:指针与字符串:1.指针2.字符类型3.字符串4.字符串计算
Custom components -- styles
Technology sharing | detailed explanation of actual combat interface test request methods get, post
As a result, fill in the birthday candles
RAID disk array
About gcc:multiple definition of
Svg understanding and drawing application
Esxi community network card driver updated in March 2022
1、 PXE overview and installation
Media set up live broadcast server
bond模式配置
codesensor:将代码转化为ast后再转化为文本向量
DNS正向解析实验
Software testing (concept)
SySeVR环境配置:joern-0.3.1、Neo4j-2.1.5、py2neo2.0
Pictures are adaptive to the screen
Shell script -- program conditional statements (conditional tests, if statements, case branch statements, echo usage, for loops, while loops)