Is escape_string what you are looking for?
julia> in = """a "b" c"""
julia> string('"',escape_string(in),'"')
"\"a \\\"b\\\" c\""
julia> parse(ans)
"a \"b\" c"
julia> out = eval(ans)
"a \"b\" c"
julia> in == out
true
On Sun, Jul 6, 2014 at 9:39 PM, Laszlo Hars <[email protected]> wrote:
> > The given example is not a parseable string.
> I wanted to parse the valid string below (of course with longer segments
> represented by the letters a, b and c, in more complex structures). The
> point is to get all the internal quotes escaped in a returned string
> expression, which I can assign to a variable.
> """a "b" c"""
> -> "a \"b\" c"
>
> It works without the eval(parse(..)) around it in the REPL console. Are
> you saying that parse() cannot handle this task?
> Your example puts the assignment inside the parsed string, which prevents
> using triple quotes for the string to be assigned, therefore it is very
> different from what I have asked.
>