How to unescape a Java string literal in Java?
The Problem The org.apache.commons.lang.StringEscapeUtils.unescapeJava() given here as another answer is really very little help at all. It forgets about \0 for null. It doesn’t handle octal at all. It can’t handle the sorts of escapes admitted by the java.util.regex.Pattern.compile() and everything that uses it, including \a, \e, and especially \cX. It has no support for … Read more