C# 关键字替换
/// <summary> /// 关键字替换 /// </summary> /// <param name="body"></param> /// <returns></returns> public string TagReplace(string body) { string[] begin = this.txtTagBegin.Text.Split('|'); string[] end = this.txtTagEnd.Text.Split('|'); string a = string.Empty, b = string.Empty; for (int i = 0; i < begin.Length; i++) { a = begin[i];//第一个关键字 if (!string.IsNullOrEmpty(a))//不为空 { try { b = end[i];//替换字符为空 } catch { } body = body.Replace(a, b); } } return body; }