Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 自动将ascii值转换为acutal字符_C#_.net - Fatal编程技术网

C# 自动将ascii值转换为acutal字符

C# 自动将ascii值转换为acutal字符,c#,.net,C#,.net,我有一根巨大的绳子,下面给出了几行: \x5b\x5b\x5b\x220B\to5Zwh\u yjxv2fkdhv2n1ndk0\x22\x5b\x220APto5Zwh\u yJXUk9PVA\x22\x5d\n\x22OfferArcade\x22\x22\x22application/vnd.google apps.folder\x22,0,0,0,0,11420466747416142044766741420444447447667672941502262110474,null\x5b\

我有一根巨大的绳子,下面给出了几行:

\x5b\x5b\x5b\x220B\to5Zwh\u yjxv2fkdhv2n1ndk0\x22\x5b\x220APto5Zwh\u yJXUk9PVA\x22\x5d\n\x22OfferArcade\x22\x22\x22application/vnd.google apps.folder\x22,0,0,0,0,11420466747416142044766741420444447447667672941502262110474,null\x5b\x5b\x5b\x5b\x5b\x204907070703264646460813\x22\x22\x22\x22Priyam,null,\x22//lh4.googleusercontent.com/-FE82xOkpzWw/aaaaaaaaaa i/aaaaaaaaaaaa d8/KPtKNTPPaNE/photo.jpg\x22

我正在寻找一种解决方案,它可以自动检测ascii码并将其转换为原始字符

例如,ascii
\x5b
实际上是一个
[


因此,我需要一个解决方案,它将自动检测所有ascii并将其转换为原始字符。

您可以使用
Regex.Unescape

//using System.Text.RegularExpressions;
string text = "\x5b\x5b\x5b\x220B_to5Zwh_yJXV2FKdHV2N1lndk0\x22"; //and so on
string decoded = Regex.Unescape(text);
Console.WriteLine(decoded);
输出:

[[["0B_to5Zwh_yJXV2FKdHV2N1lndk0"

您可以使用
Regex.Unescape

//using System.Text.RegularExpressions;
string text = "\x5b\x5b\x5b\x220B_to5Zwh_yJXV2FKdHV2N1lndk0\x22"; //and so on
string decoded = Regex.Unescape(text);
Console.WriteLine(decoded);
输出:

[[["0B_to5Zwh_yJXV2FKdHV2N1lndk0"
可能的重复可能的重复