c# - RegEx vs string manipulation functions: What is better -


if have find let's word in sentence, can think of 2 approaches

  1. using string.indexof
  2. using regex

which 1 better in terms of performance or best practice

it depends on exact requirements. if need find word in sentence (not substring), believe expressed more concisely , more explicitly using well-named regex pattern using indexof plus logic make sure you're getting complete single word.

on other hand, if you're looking substring, indexof far superior in terms of performance , readability.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -