I have a string that is returned to me which contains escape characters.
Here is a sample string
“test\40gmail.com”
As you can see it contains escape characters. I need it to be converted to its real value which is
“test@gmail.com”
How can I do this?
If you are looking to replace all escaped character codes, not only the code for
@, you can use this snippet of code to do the conversion:The code relies on a regular expression to find all sequences of hex digits, converting them to
int, and casting the resultant value to achar.