How can I convert a string containing a character escape sequence into a char?

前端 未结 1 1798
谎友^
谎友^ 2021-01-05 05:04

I\'m looking for a way to convert a string that contains a character escape sequence into the represented character.

So, for instance, I want to parse the string

相关标签:
1条回答
  • 2021-01-05 05:36

    Apache Commons to the rescue with StringEscapeUtils, you want the unescapeJava method I think: http://commons.apache.org/lang/api-2.4/org/apache/commons/lang/StringEscapeUtils.html#unescapeJava(java.lang.String)

    0 讨论(0)
提交回复
热议问题