문제

queryStr.append("\\\\%AMPAMP\\\\$"); 

after executing this line the querStr removes

one \ from the string and the final result will be:

"\%AMPAMP\$"

I want it to be:

\\\\%AMPAMP\\\\$
도움이 되었습니까?

해결책

You have to escape the slash:

queryStr.append("\\\\%AMPAMP\\\\$");

다른 팁

Do it like this:

queryStr.append("\\\\\\\\%AMPAMP\\\\\\\\$");

A character preceded by a backslash () is an escape sequence and has special meaning to the compiler. '\' Insert a backslash character in the text at this point.

You can read more here: http://docs.oracle.com/javase/tutorial/java/data/characters.html

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top