[phobos] Splitting words with delimiter

unDEFER undefer at gmail.com
Wed Aug 31 21:25:54 PDT 2011


OK. I understand, my question is too fuzzy. I try to make the concrete  
suggestion.
Really often I want to have the next statement in a language:

for(...)
{
	if first iteration
	{
		...
	}
	else
	{
		...
	}

	...

	if last iteration
	{
		...
	}
	else
	{
		...
	}
}

Of course "if first iteration" easy implemented with the "first" flag  
variable. But also as "for" makes code more clear than it's implementation  
with "while", I think this statement may help to make it more clear.
"if last iteration" maybe implementable on the compiler level only with  
constraints, but this feature maybe even more cool.

On 8/29/11 1:45 PM, unDEFER wrote:
> 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:
>
> ...
> 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