Re: std.format.formattedRead docs example does not work with a string literal as input, why?

2016-03-31 Thread ParticlePeter via Digitalmars-d-learn
On Thursday, 31 March 2016 at 18:25:45 UTC, H. S. Teoh wrote: On Thu, Mar 31, 2016 at 06:23:21PM +, ParticlePeter via Digitalmars-d-learn wrote: Example from docs: string s = "hello!124:34.5"; string a; int b; double c; formattedRead(s, "%s!%s:%s", , , ); assert(a == "hello" && b == 124 &&

Re: std.format.formattedRead docs example does not work with a string literal as input, why?

2016-03-31 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Mar 31, 2016 at 06:23:21PM +, ParticlePeter via Digitalmars-d-learn wrote: > Example from docs: > string s = "hello!124:34.5"; > string a; > int b; > double c; > formattedRead(s, "%s!%s:%s", , , ); > assert(a == "hello" && b == 124 && c == 34.5); > > now changing the first

std.format.formattedRead docs example does not work with a string literal as input, why?

2016-03-31 Thread ParticlePeter via Digitalmars-d-learn
Example from docs: string s = "hello!124:34.5"; string a; int b; double c; formattedRead(s, "%s!%s:%s", , , ); assert(a == "hello" && b == 124 && c == 34.5); now changing the first formattedRead argument to a string literal: formattedRead("hello!124:34.5", "%s!%s:%s", , , ); results in this