, , .
In your first argument for, replace()you intend to pass a string containing \, but it ends as ", (quote-comma-space)! This is because you really avoid “closing” the quotation in a line:
g = g.replace("\", "\\\\");
^ ^
s e
t n
a d
r
t
Now the first argument is the quote-comma-space string. The rest gives a syntax error!
What did you want:
g = g.replace("\\", "\\\\\\\\");
^ ^ ^ ^
s e s e
t n t n
a d a d
r r
t t
First argument: string \
Second argument: string\\\\
source
share