On Wednesday, 27 February 2013 at 20:37:01 UTC, Lubos Pintes wrote:
And what about the opposite way? I like how Python is representing strings. Good when you want to partially inspect something binary.
Dňa 27. 2. 2013 19:39 monarch_dodra  wrote / napísal(a):
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?

using formattedWrite, I can print it out the same way, but there will also be the trailing " " I'll have to chop off manually (hence why I have to pass through a formatted write first, as opposed to a straight up writef).

Reply via email to