c# - Replace entire text with XXX using RegEx -


How can convert entire text to XXX using C # in regx? This will change the number of x which will be equal to the length of the string.

For example xxxxx

has the original text apple XX

with high XXXXXX

with cricket > outstanding With XXXXXXXXXXX

  string mytext = "apple"; // I get regexp to get string output = "xxxxx" for the following line; // Apple will replace with 5x x because without the apple Long = 5    

without regex:

  string S = "The original text for example is replacing the apple"; Var ChangeWord = "Apple"; Var s2 = s.Replace (replaceWord, new string ('X', replaceWord.Length));   

The new string ('X', replaceWord.Length) creates a string with 'X' characters with the same string as replaceWord .

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -