Yes it can be a bit confusing. The string returned by replace does have single-quotes replaced by double-quotes, but the interactive result output presents the double-quotes prefixed by backslash.
Thus, when the string has a double quote, the result printing of that string shows \" so as to indicated that the double-quote is not ending the string. Likewise, the result printing adds the double-quotes before and after printing the string content, and those double-quotes are not characters in the string.
If you make it be
In short, a string of a single double-quote characters is written "\"", and it will be taken as such if input and printed as such by the interactive output. The print function doesn't add meta-characters. Here's an illustration example:
Thus, when the string has a double quote, the result printing of that string shows \" so as to indicated that the double-quote is not ending the string. Likewise, the result printing adds the double-quotes before and after printing the string content, and those double-quotes are not characters in the string.
If you make it be
Code Select
(print (replace ....))
then the string will be printed without extras before double-quotes, but the interactive output coming after will still show the string with that meta-character wrapping.In short, a string of a single double-quote characters is written "\"", and it will be taken as such if input and printed as such by the interactive output. The print function doesn't add meta-characters. Here's an illustration example:
Code Select
> (println "\"")
"
"\""
>
The first line is what the println function prints (which is the "raw" string content with a newline added at end), and the second line is the interactive output of the value returned by the println function (the same string but with meta-characters to make it be the character sequence the input reader would need).