在PowerShell中,如何对Unicode转义的字符串进行转义?

$str1 = "http:\u002f\u002fgoogle.com\u002fsomething\u002ftest"


http://google.com/something/test

最佳答案

执行此操作的代码是:

[Regex]::Replace($str1, "\\[Uu]([0-9A-Fa-f]{4})",
         {[char]::ToString([Convert]::ToInt32($args[0].Groups[1].Value, 16))} )

关于powershell - unescape unicode字符串powershell,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/18450218/

10-12 17:34