Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想 \ ,,/在 Java 中显示为字符串,但我得到无效的转义序列。
\ ,,/
尝试了所有可能的方法
String Metal= "'\'"+",,/"; Toast a= Toast.makeText(getApplicationContext(), Metal, Toast.LENGTH_LONG); a.show(); String Metal= "\"+",,/";
输出为",,/
",,/
我怎样才能做到这一点?
只需逃避\:
\
String Metal = "\\,,/";
这将起作用:String Metal= "'\\'"+",,/";
String Metal= "'\\'"+",,/";
你可以试试这个
String Metal= "\\ ,,/ ";
你必须逃脱\这就是为什么\\在这里。
\\