function asc($param) { 
$rtn = ''
$list = $param -split ''
foreach ($char in $list)
{
    if($char -ne '')
    {
       $rtn = $rtn + ("\u" + ("{0:x}" -f [int]([char]$char)))
    }
}
return $rtn 
}

 

$source="\u54ce\u5466\u4e0d\u9519\u54e6"
$evaluator={
param($v)
[char][int]($v.Value.replace('\u','0x'))
}
[regex]::Replace($source,'\\u[0-9-a-f]{4}',$evaluator)

write-host "Press any key to continue..."

read-host

 

相关文章:

  • 2022-12-23
  • 2021-07-25
  • 2022-12-23
  • 2022-12-23
  • 2021-12-13
  • 2021-07-19
  • 2022-03-05
猜你喜欢
  • 2021-12-15
  • 2022-02-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案