Problem with string.whitespace and newline

2011-06-11 Thread Michael Chen
The following code cannot be compiled string clean(string x) { return join(split(x),whitespace); } The compile error is Error 2 Error: template std.array.join(RoR,R) if (isInputRange!(RoR) isInputRange!(ElementType!(RoR)) isForwardRange!(R)) cannot deduce template function from

Re: Problem with string.whitespace and newline

2011-06-11 Thread Andrej Mitrovic
try return join(split(x),whitespace[]); It seems whitespace is a static array. On 6/12/11, Michael Chen sth4...@gmail.com wrote: The following code cannot be compiled string clean(string x) { return join(split(x),whitespace); } The compile error is Error 2 Error: template

Re: Problem with string.whitespace and newline

2011-06-11 Thread Michael Chen
Thanks Andrej, it works. On Sun, Jun 12, 2011 at 9:14 AM, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: try return join(split(x),whitespace[]); It seems whitespace is a static array. On 6/12/11, Michael Chen sth4...@gmail.com wrote: The following code cannot be compiled string

Re: Problem with string.whitespace and newline

2011-06-11 Thread Andrej Mitrovic
I've said it before, but I'll say it again: this is such a common error that it needs a better error message. Something as simple as this will do: foo can't take bar of type char[16]. Try using a slice: bar[].

Re: Problem with string.whitespace and newline

2011-06-11 Thread Jonathan M Davis
On 2011-06-11 18:46, Andrej Mitrovic wrote: I've said it before, but I'll say it again: this is such a common error that it needs a better error message. Something as simple as this will do: foo can't take bar of type char[16]. Try using a slice: bar[]. Have you created an enhancement request

Re: Problem with string.whitespace and newline

2011-06-11 Thread Andrej Mitrovic
I can't seem to find anything specific like an enhancement request. Here's a similar report by you: http://d.puremagic.com/issues/show_bug.cgi?id=4971 Maybe we should have a 'common (newbie) mistakes' section on the website and add this bit of information there.

Re: Problem with string.whitespace and newline

2011-06-11 Thread Jonathan M Davis
On 2011-06-11 19:29, Andrej Mitrovic wrote: I can't seem to find anything specific like an enhancement request. Here's a similar report by you: http://d.puremagic.com/issues/show_bug.cgi?id=4971 Maybe we should have a 'common (newbie) mistakes' section on the website and add this bit of

Re: Problem with string.whitespace and newline

2011-06-11 Thread Jonathan M Davis
On 2011-06-11 19:41, Jonathan M Davis wrote: On 2011-06-11 19:29, Andrej Mitrovic wrote: I can't seem to find anything specific like an enhancement request. Here's a similar report by you: http://d.puremagic.com/issues/show_bug.cgi?id=4971 Maybe we should have a 'common (newbie)