62,046
社区成员
发帖
与我相关
我的任务
分享
private string GetUrlRule(int position, string input)
{
return Regex.Replace(parm, @"(?<=^(\d+_){" + position + @"})\d+", input);
}
private string GetUrlRule(int position, string input)
{
return Regex.Replace(parm, @"(?<=^(\d+_){" + position + @"})\d+", input);
}
private string GetUrlRule(int position, string input)
{
return Regex.Replace(parm, @"(?<=^(\d+_){" + position + @"})\d+", input);
}
private const string parm = "20_341_21_33_14_5_6_7_9.htm";
public static string GetUrlRule(int position, string input)
{
string[] tmp = parm.Split(new char[] { '_', '.' }, StringSplitOptions.RemoveEmptyEntries);
tmp[position] = input;
string res = string.Join("_", tmp, 0, tmp.Length - 1) + "." +tmp[tmp.Length - 1];
return res;
}
static void Main(string[] args)
{
Console.WriteLine(GetUrlRule(3, "77"));
}