www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9605] New: std.conv.parse!(string, string) fails


           Summary: std.conv.parse!(string, string) fails
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: monarchdodra gmail.com

--- Comment #0 from monarchdodra gmail.com 2013-02-27 03:52:47 PST ---
Basically, std.conv.parse!(string, string) expects the string to be in the form
of an array of chars:

import std.conv;

void main()
  string s1 = `[['h', 'e', 'l', 'l', 'o'], ['w', 'o', 'r', 'l', 'd']]`;
  string s2 = `["hello", "world"]`;
  string s3 = `['h', 'e', 'l', 'l', 'o']`;
  string s4 = `"hello"`;

  auto ss1 = parse!(string[])(s1);
  auto ss2 = parse!(string[])(s2);
  auto ss3 = parse!(string  )(s3);
  auto ss4 = parse!(string  )(s4); //Can't parse string: "[" is missing

The irony though is that if you place the string inside an array (s1 and s2),
then conv will actually support both forms of parse.

Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 27 2013