Re: Splitting a String
- From: Jon Skeet [C# MVP] <skeet@xxxxxxxxx>
- Date: Sun, 21 May 2006 16:20:57 +0100
Ludwig <none@xxxxxxxx> wrote:
And this is a good example of why you should really think about whether
regular expressions are the right solution before using them. Pretend
you don't know what the bit of code is meant to do, and read the
version above. Then read Nick's version using String.Substring. I know
which I find significantly simpler to understand...
I agree! The format is well-known, so RegEx is not the best and most
simple solution. Of course, if you are a regular expressions expert,
this piece of code may be just as simple as using SubString...
Only if you can assume that *everyone* who is going to read/maintain
the code is as happy with regular expressions. Don't forget that code
spends more time being maintained than being written - and it's often
maintained by different people.
--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
.
- References:
- Splitting a String
- From: Materialised
- Re: Splitting a String
- From: Rene Sørensen
- Re: Splitting a String
- From: Jon Skeet [C# MVP]
- Re: Splitting a String
- From: Ludwig
- Splitting a String
- Prev by Date: Re: about performace between ++i and i++
- Next by Date: Displaying Multicolored text in a control
- Previous by thread: Re: Splitting a String
- Next by thread: Re: Splitting a String
- Index(es):
Relevant Pages
|