On 2011-10-28 19:07, Jesse Phillips wrote:
Jacob Carlborg Wrote:
If a header is specified, is it possible to iterate over the content as
an associative array, something like this:
string str = "a,b,c\nHello,65,63.63\nWorld,123,3673.562";
auto records = csvText(str, ["b"]);
foreach (header, value ; records) {}
Or accessing a value by header:
foreach (record ; records)
{
auto value = record["a"];
auto val = record.b; // perhaps using opDispatch as well
}
--
/Jacob Carlborg
If I implemented it this way then the entire record would be read in when a
header exists.
auto records = csvText!(string[string])(str, ["b"]);
Would that be acceptable?
That would be acceptable to me, don't know what how other would see it.
--
/Jacob Carlborg