Might be negative pattern in Perl with its join() and map() builtins, but assuming you happen to be forced to write code is a language that doesn't provide anything similar ... I use something like this quite often actually when "working" in VBScript. Better than trying to make sure you do not put the separator before the first item or after the last one. Recently had a problem with some code that tried that. And failed miserably because it did not take into account that the joined values could be empty.
Jenda
We'd like to help you learn to help yourself
Look around you, all you see are sympathetic eyes
Stroll around the grounds until you feel at home
-- P. Simon in Mrs. Robinson |