String Remove or substring

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

hi,
are there any performance differences for taking same substring portion by
using remove and substring methods? do these methods behave semantically
same for taking same substring portion? is it possible to know this exactly?
thanks
 
Mark,
Does it really matter?

I would use the one that has the correct semantics of where I am using it.
If I wanted a substring I would use Substring, if I wanted to cut part of
the string away I would use Remove.

Generally I would only need to use Remove, if I wanted to remove something
from the middle of a string (where two sub strings are needed). If I needed
the head or tail of a string I would use Substring, although remove on the
opposite end would be semantically equivalent.

I normally don't code for performance, I code for semantics. Then when a
given routine is demonstrated to have a performance issue (via Profiling). I
will refactor that routine for performance.

Hope this helps
Jay
 
Back
Top