Follow me on Twitter RSS FEED

 issue in c#

Posted in
Code to remove Â in C#
Mostly occurs while working with html document file.
Best option is to replace all occurrences of this character.

  html = Regex.Replace(html, "[^\u0000-\u007F]", " ");//for space
  html = Regex.Replace(html, "[^\u0000-\u007F]", string.Empty);//for empty string

Replace string with only first match in C#

Posted in
Code to replace string with only first match in C#
string ReplaceFirstOccurence(string wordToReplace, string replaceWith, string Input)
        {
            Regex r = new Regex(wordToReplace, RegexOptions.IgnoreCase);
            return r.Replace(Input, replaceWith, 1);
        }