Parsing string to string?

monarch_dodra monarchdodra at gmail.com
Wed Feb 27 10:39:30 PST 2013


I have a text file, that contains text with escaped characters, 
eg:

//----
hello\tworld.
this line\ncontains a break.
and this one a\x20binary character.
and this one\u0020an escaped unicode.
//----

The idea is that once parse line by line, I want 4 strings (1 for 
each line), but with the escaped characters parsed to their 
normal value.

I'm having trouble doing this efficiently. I can do it with 
std.conv.parse, but provided I preppend and append a double quote 
to my strings first. It's not the most efficient way to do it, 
but it works. It's kind of hackish though :/

I was wondering if there anything in phobos that could do this 
more naturally? Or in an "idiomatic" fashion?


More information about the Digitalmars-d-learn mailing list