求大神帮忙,后台如何获取多个字段
例如:this.testbox.text="【删除】XXX.JPG【删除】XXX.text【删除】XXX.doc"
该如何获得删除后面的文件名称和格式
------解决方案--------------------this.testbox.text="【删除】XXX.JPG【删除】XXX.text【删除】XXX.doc"
string[] temp=testbox.text.Replace("【删除】",'
------解决方案--------------------').Split('
------解决方案--------------------');
------解决方案-------------------- string s = "【删除】XXX.JPG【删除】XXX.text【删除】XXX.doc";
MatchCollection matches = Regex.Matches(s, @"【删除】([^【】]+)");
foreach (Match match in matches)
Response.Write(match.Groups[1].Value + "<br/>");
------解决方案--------------------string[] list==string.format("【删除】XXX.JPG【删除】XXX.text【删除】XXX.doc")
.Split(new string(){"【删除】"},StringSplitOptions.RemoveEmptyEntries)
------解决方案--------------------
string str = "【删除】XXX.JPG【删除】XXX.text【删除】XXX.doc";
var ary = Regex.Matches(str, @"(?<=[【】\[\]]删除[【】\[\]])[^【】\[\]]+").OfType<Match>().Select(t => t.Value).ToArray();
------解决方案-------------------- string input = "【删除】XXX.JPG【删除】XXX.text【删除】XXX.doc";
string[] temp = input.Replace("【删除】", "
------解决方案--------------------").Split('
------解决方案--------------------');
foreach (var item in temp)
{
Console.WriteLine("文件名称:{0} 格式:{1}",System.IO.Path.GetFileNameWithoutExtension(item),System.IO.Path.GetExtension(item));
}
------解决方案-------------------- string s = "【删除】XXX.JPG【删除】XXX.text【删除】XXX.doc";
string[] filenames = Regex.Matches(s, @"【删除】([^【】]+)").Cast<Match>().Select(x => x.Groups[1].Value).ToArray();
for (int i = 0; i < filenames.Length; i++)
Response.Write(filenames[i] + "<br/>");