字符串截取 E:\OfficeChannel\OfficeChannel\CourseChannel\CourseUpdate\4f3508e0-7055-45ab-9601-473ab541ef46and20081210\XML.zip原 我想要CourseUpdate\4f3508e0-7055-45ab-9601-473ab541ef46and20081210\XML.zip 怎么截取 还有我想研究一下截取字符串和正则中的匹配朋友们给我点学习资源谢谢.. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 正则资料:http://www.tracefact.net/document/Regular-Expression-Tutorial.pdf string sss = @"E:\OfficeChannel\OfficeChannel\CourseChannel\CourseUpdate\4f3508e0-7055-45ab-9601-473ab541ef46and20081210\XML.zip"; respose.write(sss.Substring(sss.IndexOf("CourseChannel")));//这个就是你要的结果 什么规则?磁盘的第三层目录开始?string pattern=@"(?<=[a-zA-Z]:\\(?:[^\\]+\\){2})[\s\S]*?\.[0-9a-zA-Z]+"; string words="E:\OfficeChannel\OfficeChannel\CourseChannel\CourseUpdate\4f3508e0-7055-45ab-9601-473ab541ef46and20081210\XML.zip"; string[] split = words.Split(new Char[] { '\' });stringt new;for(int i=4;i<split.lenth;i++){new+=split[i].tostring();} 更正一下string words="E:\OfficeChannel\OfficeChannel\CourseChannel\CourseUpdate\4f3508e0-7055-45ab-9601-473ab541ef46and20081210\XML.zip"; string[] split = words.Split(new Char[] { '\' }); string new; for(int i=4;i <split.lenth;i++) { new+=split[i].ToString()+"\"; }response.write(new); string path = "E:\\OfficeChannel\\OfficeChannel\\CourseChannel\\CourseUpdate\\4f3508e0-7055-45ab-9601-473ab541ef46and20081210\\XML.zip"; path = path.Substring(2, path.Length - 2); string fin = string.Empty; string[] s = path.Split("\\".ToCharArray()); for(int i=3;i<s.Length;i++) { fin += s[i].ToString() + "\\"; } fin = fin.Substring(0, fin.Length - 1); Response.Write(fin); string[] split = words.Split(new Char[] { ',', '.' }, 2);//返回:{"1","2.3,,4"}string words="E:\OfficeChannel\OfficeChannel\CourseChannel\CourseUpdate\4f3508e0-7055-45ab-9601-473ab541ef46and20081210\XML.zip"; string[] split = words.Split(new Char[] { '\' },4); response.write(split[2].tostring()); string path = "E:\\OfficeChannel\\OfficeChannel\\CourseChannel\\CourseUpdate\\4f3508e0-7055-45ab-9601-473ab541ef46and20081210\\XML.zip"; string fin = string.Empty; string[] s = path.Split("\\".ToCharArray()); for(int i=4;i<s.Length;i++) { fin += s[i].ToString() + "\\"; } fin = fin.Substring(0, fin.Length - 1); Response.Write(fin); config 配置 求一个请求的地址。。。 高手们,帮哥解决个小问题吧 js 根据数据库生成tree 存储过程循环取记录问题 求教,asp.net从客户端读取的数据是乱码 数字型数据输入问题 DataGrid分页+两个页之间传递参数的问题,请高手来看看,谢谢!! 放分征集域名 请各位帮我好好想一想 起步问题 —— 为什么我的DataGrid不显示数据 如何将存储过程查询到的结果集手动地绑定到objectdatasource? vs2005的treeview控件中,删除一个节点后,自动选中上一个节点,怎么实现?
http://www.tracefact.net/document/Regular-Expression-Tutorial.pdf
respose.write(sss.Substring(sss.IndexOf("CourseChannel")));//这个就是你要的结果
string pattern=@"(?<=[a-zA-Z]:\\(?:[^\\]+\\){2})[\s\S]*?\.[0-9a-zA-Z]+";
string[] split = words.Split(new Char[] { '\' });
stringt new;
for(int i=4;i<split.lenth;i++)
{
new+=split[i].tostring();
}
string words="E:\OfficeChannel\OfficeChannel\CourseChannel\CourseUpdate\4f3508e0-7055-45ab-9601-473ab541ef46and20081210\XML.zip"; string[] split = words.Split(new Char[] { '\' });
string new;
for(int i=4;i <split.lenth;i++)
{
new+=split[i].ToString()+"\";
}
response.write(new);
string path = "E:\\OfficeChannel\\OfficeChannel\\CourseChannel\\CourseUpdate\\4f3508e0-7055-45ab-9601-473ab541ef46and20081210\\XML.zip";
path = path.Substring(2, path.Length - 2);
string fin = string.Empty;
string[] s = path.Split("\\".ToCharArray());
for(int i=3;i<s.Length;i++)
{
fin += s[i].ToString() + "\\";
}
fin = fin.Substring(0, fin.Length - 1);
Response.Write(fin);
string words="E:\OfficeChannel\OfficeChannel\CourseChannel\CourseUpdate\4f3508e0-7055-45ab-9601-473ab541ef46and20081210\XML.zip"; string[] split = words.Split(new Char[] { '\' },4);
response.write(split[2].tostring());
string path = "E:\\OfficeChannel\\OfficeChannel\\CourseChannel\\CourseUpdate\\4f3508e0-7055-45ab-9601-473ab541ef46and20081210\\XML.zip";
string fin = string.Empty;
string[] s = path.Split("\\".ToCharArray());
for(int i=4;i<s.Length;i++)
{
fin += s[i].ToString() + "\\";
}
fin = fin.Substring(0, fin.Length - 1);
Response.Write(fin);