foreach over split string

Artur Skawina art.08.09 at gmail.com
Wed Jul 17 08:57:36 PDT 2013


On 07/17/13 16:38, JS wrote:
> it is is a lot of work to simplify my code to something that will make sense 

Indeed.


> If it will make you feel better to see some code, which does work,

[...snipped incomplete example which doesn't...]


> template tSplitStr(string n, string d = " ") { enum tSplitStr = std.string.split(n, d); }

Use a function and forget about '!':

   auto tSplitStr(string n, string d = " ") { return std.string.split(n, d); }
   //...
   foreach(nt; tSplitStr(tPDeclH!(T), "&"))



> you don't get a golden ticket for answering correctly

I was going to explain /why/ your code can't work. But without a ticket? Hmm.
Nah.


artur


More information about the Digitalmars-d-learn mailing list