gpt4 book ai didi

powershell - unescape unicode字符串powershell

转载 作者:行者123 更新时间:2023-12-03 00:52:47 28 4
gpt4 key购买 nike

在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/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com