[Issue 9605] New: std.conv.parse!(string, string) fails
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Wed Feb 27 03:52:48 PST 2013
    
    
  
http://d.puremagic.com/issues/show_bug.cgi?id=9605
           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 at puremagic.com
        ReportedBy: monarchdodra at gmail.com
--- Comment #0 from monarchdodra at 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
  return;
}
//----
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: -------
    
    
More information about the Digitalmars-d-bugs
mailing list