GetControlValue 为函数
public static string ReplaceControlName(AsapExlib.Base.BaseForm bf,string Txt)
{
foreach (Match m in Regex.Matches(Txt, @"/{(.+?)/}"))
{
Txt = Txt.Replace(m.Groups[0].Value, GetControlValue(bf, m.Value));
}
return Txt;
//System.Text.RegularExpressions.Regex.Replace(Txt, @"/{(.+?)/}", GetControlValue(bf,"$1"), System.Text.RegularExpressions.RegexOptions.IgnoreCase);
}
本文介绍了一种在C#中实现的字符串替换方法,该方法通过遍历匹配到的控制符名称并利用特定函数GetControlValue来获取对应的值进行替换。此过程涉及到正则表达式的使用,以实现对指定格式的字符串进行解析和替换。
10万+

被折叠的 条评论
为什么被折叠?



