将字符串转换为字符串文字

时间:2011-07-21 14:43:45

标签: java string string-literals

  

可能重复:
  How would you convert a String to a Java string literal?

是否有一个库函数接受一个字符串并将其转换为相应的字符串文字?例如:

Please say\ask "What?" three times! - > "Please say\\ask \"What?\" three times!"

1 个答案:

答案 0 :(得分:7)