Skip to content

Instantly share code, notes, and snippets.

@toshiyukino
Created December 6, 2013 06:23
Show Gist options
  • Save toshiyukino/7819403 to your computer and use it in GitHub Desktop.
Save toshiyukino/7819403 to your computer and use it in GitHub Desktop.
VBAでユニコードエスケープされた文字を復元.意外と短くできた
Sub test()
Set re = CreateObject("VBScript.RegExp")
re.Pattern = "\\u([a-fA-F0-9]{4})"
re.Global = True
re.IgnoreCase = True
re.MultiLine = True
a = "\u3042\u3044\u3046\u3048\u304A" 'あいうえお
Set mc = re.Execute(a)
For Each m In mc
For Each s In m.submatches
a = Replace(a, "\u" & s, ChrW("&h" & s))
Next
Next
MsgBox a
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment