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

delphi - TJvHidDeviceController "DevicePath" always showing "\" -

Disabling Android home button for industry application -

asp.net mvc 3 - Unexpected "foreach" keyword after "@" character -