I think you’re just seeing the REPL printing the String object, which
represents backslashes as escaped. Printing the result should clarify things:
julia> replace("my_beautiful_string", "_", "\\_")
"my\\_beautiful\\_string"
julia> println(replace("my_beautiful_string", "_", "\\_"))
my\_beautiful\_string
On September 8, 2015 at 17:07:56, [email protected] ([email protected]) wrote:
Hi all,
I'm trying to do a simple thing, adding a backslash before every underscore in
a string, ex: my_beautiful_string should become my\_beautiful\_string.
To do that, I tried:
julia> replace("my_beautiful_string", "_", "\_")
"my_beautiful_string"
julia> replace("my_beautiful_string", "_", "\\_")
"my\\_beautiful\\_string"
I looked it up but I didn't find an answer, any suggestion?