I\'m using NET 2.0 and WinForms.
Currently, I need a code to replace a string with another one in a given text, but in the text it should only look for whole words. What
I think you cannot achieve that string replace any faster (I'm talking about developing time) than by RegExp
string input = @"COUNTER = $40 CLOCK_COUNTER = $60";
string pattern = @"\bCOUNTER\b";
string replacement = "COUNT";
var regex = new Regex(pattern,RegexOptions.Compiled);
string result = regex.Replace(input, replacement);
Adding RegexOptions.Compiled makes it faster if you intend to reuse
-------------------UPDATE-----------------------------
i remembered about this article that may fit your needs:
http://www.codeproject.com/KB/string/fastestcscaseinsstringrep.aspx