Hello Daniel,
No it isn't. From what i can see he wants the inner part of tags between
the '>' and '<' as well as the image source location from his example. All
of which is easy to do using substring and indexof. Get the first one,
then start at the end of the first one and repeat until end of file.
Hm... I may be a bit unclear after all on the intentions of the OP. Still,
I see him mentioning samples without any delimiter at all, plus the one
where he shows the string in question to be an attribute to what may be an
XML tag. That makes at least two different delimiters - the '"' and the
end of the line or word. That's what I was referring to, I'm not sure
whether it was the OP's intention or just the fact that the samples were
given out of context.
I also think we're having a misunderstanding here - your comment above
seems to relate solely to the part of the problem where the "name" has to
be found, while my own solution, admittedly, focused solely on the part
where the number is to be found.
Performance should always be an issue in my opinion
I don't agree, sorry. I wouldn't be using .NET as a development platform
if performance was a general concern of mine. I'm not saying it's not
important - I'm saying that acceptable performance is something that can
usually be reached easily these days while relying on the convenience
functionality provided to us by advanced programming features like regular
expressions or indeed managed code.
but yes regex is a viable alternative but not as versatile, if later
images/myPic.jpg were used or images/myfolder regex would fail and
substring would not.
I don't agree once more. There's no technology as versatile for pattern
matching as regular expressions - writing an algorithm manually may in any
single case be more performant or actually enable features that wouldn't
easily be possible with regular expressions. But as a general purpose
toolset regular expressions are much easier to use and to maintain than
any such algorithm could ever be.
Obviously the regular expression I was using in my example took into
account the precise samples the OP was giving, so it would miss the
additional samples you're now mentioning. In the same way I could
criticize that your SubString idea would by default accept "myPic.jpg",
while only names consisting of digits were to be allowed.
Oliver Sturm