I\'m processing some Java source code using Java. I\'m extracting the string literals and feeding them to a function taking a String. The problem is that I need to pass the
org.apache.commons.lang3.StringEscapeUtils
from commons-lang3 is marked deprecated now. You can use org.apache.commons.text.StringEscapeUtils#unescapeJava(String) instead. It requires an additional Maven dependency:
org.apache.commons
commons-text
1.4
and seems to handle some more special cases, it e.g. unescapes:
\\b
, \\n
, \\t
, \\f
, \\r