When to use Regex vs Built in String Methods?

后端 未结 6 669
庸人自扰
庸人自扰 2021-01-12 07:03

I\'ve noticed a lot of little debates about when to use regex and when to use a built in string function like String.Replace() (.NET).

It seems a lot of people recom

6条回答
  •  情话喂你
    2021-01-12 07:32

    I would tend to think that if there is a dedicated function to manipulate a string the way you want as part of the string class, it should pretty close to 'good' where-as regex is general purpose.

    But as with anything subjective, if you are concerned about performance time the different methods.

    Then again do what easiest to understand, and do performance monitoring to find the real bottle necks as you go.

提交回复
热议问题