As far as performance goes, my experience is that split is an "expensive thing" CPU wise. A regex that tests whether a line starts with X is a relatively inexpensive thing. I have also found that the join() operation is very performant - i.e. joining 12 things together is way faster than splitting one thing into 12 things. Anyway I think the performance enhancement here is to not do a split at all unless you have to - my code is shown below which uses a regex to decide whether to split or not split.
In reply to Re^2: Problem with inline replace
by Marshall
in thread Problem with inline replace
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |