Parsing string to string?

Lubos Pintes lubos.pintes at gmail.com
Wed Feb 27 12:37:00 PST 2013


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?



More information about the Digitalmars-d-learn mailing list