Does C++ consider \/ as an escape character?
And does Java consider it? I am talking about forward and backslashes. Please tell. How does Java and C++ considers them differently? I mean :

in C++: this '/' works fine without escape.
in Java: this '\/' will result in '/'.

Is it correct or wrong?

Please clarify.

AFAIK, escape sequences are identical in Java and C++ string literals. They both inherited them from C. The way escape sequences work is that there are a number of special sequences, like \n, \r, etc... for things like new lines and carriage return characters, but for everything else, if you have the backslash character followed by anything, it escapes to being just the following character, like \\ -> \, \h -> h, \" -> ", etc..

@mike. Thanks mike. but please tell me this thing that I have one string say :

"nitinkdjdhdgshs/djjkdkd"

mark that slash in it. Now when I add it into json string then it should be like this:

"cipher": "nitinkdjdhdgshs\/djjkdkd"

then: when i put that again in one json string, it should be like this:

"payload" : {"cipher": "nitinkdjdhdgshs\\/djjkdkd"}

Is it correct as per the json-glib? How should I achieve this?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.