Is there any way to to interpret a string such as “hello\r\n\world” into a string where \r\n has been converted into their actual literal values.
The scenario is that a user types in a regex replacement expression and types \r\n in the UI. That get’s escaped but I’d like to get the actual interpreted string from that.
The Apache commons
StringEscapeUtils.unescapeJava(...)methods will do the job. Though it is not clear from the javadoc description, these methods handle unicode escapes as well as “ordinary” Java String escapes.