Is there a Java method that works like Python\'s repr? For example, assuming the function were named repr,
\"foo\\n\\tbar\".repr()
would re
If you're only going to be using this on strings, in a pinch you could just write a method that goes through the string and replaces special characters (for whatever definition of "special" you want) with their escape codes. That's what I would do. (I did a quick search and nothing came up on Google, so it might be faster to just write the method than to hunt for an existing implementation)