[phobos] Splitting words with delimiter
unDEFER
undefer at gmail.com
Mon Aug 29 11:45:37 PDT 2011
Hello!
So as I understand that D tries to make really practical tasks more easy I
want to ask about one often meeting task.
If I want to print words with delimiter I can do it with 3 ways:
1)
<print first word>
foreach <other word>
print ", " ~ <word>
end for
2)
foreach <all words>
if (not first)
print ", "
print <word>
end for
3)
foreach <all words>
print <word> ~ ", "
end for
if <list of words not empty>
<delete last character>
But sometimes there is other similar tasks which makes any from this
approach very ugly.
The simple example: putting array of strings to cells of tables on the
pages. Each page is table with 5 rows and 2 columns. And print at the end
of each page the "next" or "first" (for last page) button.
I really don't remember details but in my anyfs-tools.sf.net I had many
examples of this task and it was not connected with just printing.
If there is any good methods to do any complex case of this task more
beautiful with D?
Thank you.
--
Nikolay Krivchenkov aka unDEFER
I want to believe... in unDE.su
registered Linux user #360474
Don't worry, I can read OpenOffice.org/Libre Office/Lotus Symphony
documents
More information about the phobos
mailing list