First, if you are dealing with CSV files, do not use a regular expression or your own parser. Basically, when you think that everything is simple, they really are not, Stop Rolling Your Own CSV Parser .
Next, you say you want to have an array ([3, "asdf", "* #", 1212.3]). This is similar to type mixing and cannot be done in a static language. And ultimately very inefficient even using std.variant. For each value analyzed, you should have a code:
try {
auto data = to!double(parsedValue);
auto data2 = to!int(data);
if(data == data2)
returnThis = Variant(data2);
else
returnThis = Variant(data);
} catch(ConvException ce) { }
Now, if your data is really separated by a specific character set and not broken into newline entries, you can use split (",") from std.algorithm. Otherwise, use the CSV parser. If you do not want to follow the standard parser wrappers, the data is yours. In your example, you have spaces that should not be ignored in CSV format, so call strip () on the output.
, , , , . , CSV, , . , , CSV.
, , CSV Parser D. , , , . unittest. :
struct MyData {
int a;
string b;
string c;
double d
}
foreach(data; csv.csv!MyData(str))