According to everything I have read on PM, the use of rindex() and substr() is a poor way to do this task.
What the...? Can anyone second that (with examples and vivid explanation please)?
I kind of refuse to believe this job should not be done with substr and rindex.
Its just a code snippet....one that works, no less!
One that prints data to the screen, even when not debugging. Not quite useable in most circumstances.
Besides, it doesn't work with all valid filenames:
parse_out_extension 'foo.b(ar';
parse_out_extension 'foo.**';
No, using arrays and several iterations, printing useless text and not escaping is not a better solution than a pure regex one.
Substr+rindex is the best solution for this, followed by a substitution, but "solutions" like yours are, imho, out of the question.
No offense meant.
U28geW91IGNhbiBhbGwgcm90MTMgY
W5kIHBhY2soKS4gQnV0IGRvIHlvdS
ByZWNvZ25pc2UgQmFzZTY0IHdoZW4
geW91IHNlZSBpdD8gIC0tIEp1ZXJk
|