Home > Net >  Help to replace
Help to replace

Time:01-22

 
Dictionary Dic=new Dictionary (a);
Dic. The Add (1, "AAA");
Dic. The Add (2, "BBB");
Dic. The Add (12, "CCC");

String a="12";

The foreach (var temp in dic)
{
A=Regex. Replace (a, $" \ \. {temp. Key} (?=[^ \ \ d]) ", temp., Value);
}


If it is "12" will replace
But in the end only. 12 won't replace CCC,
O how change

CodePudding user response:

Under what data that you have to do something, I'm not familiar with regular expressions, so the code also try to avoid using this, tell your requirements, give you a other solution.
  •  Tags:  
  • C#
  • Related