formattedRead string without allocation?

Steven Schveighoffer schveiguy at yahoo.com
Sat Feb 24 21:00:29 UTC 2018


I want to use formattedRead to enforce a certain format, and easily 
parse out the data from a string.

But if I do:

string s = "123:abc:123";

string y;
assert(s.formattedRead!"123:%s:123"(y) == 1);

y is now a newly-allocated string, not a slice of the input. In the case 
of parsing strings out of strings that aren't going away, it would be 
much more advantageous to simply slice the input. Is there something 
that does this?

-Steve


More information about the Digitalmars-d-learn mailing list