Regex.Replace, String.Replace or StringBuilder.Replace which is the fastest?

前端 未结 2 551
生来不讨喜
生来不讨喜 2021-01-25 03:21

I need to replace all System.Environment.Newline(s) in the string returned by my function with System.Environment.Newline + \\t (as I am trying to appl

2条回答
  •  感动是毒
    2021-01-25 04:00

    Compiled Regex will be faster, however, unless the string is massive and is being run on a myriad of strings, String.Replace() is the way to go for the sake of readability.

提交回复
热议问题