Skip to content

Instantly share code, notes, and snippets.

@ooltcloud
Created August 31, 2015 16:49
Show Gist options
  • Save ooltcloud/c18a23e88e1b90bb06a1 to your computer and use it in GitHub Desktop.
Save ooltcloud/c18a23e88e1b90bb06a1 to your computer and use it in GitHub Desktop.
制御文字を可視化する
function VisualizeControlCharacter($s) {
-join (
$s.ToCharArray() |
% {
switch -regex ($_){
'[\u0000-\u001F]' { [Char]([Int16]$_ + 0x2400) };
'[\u0020]' { [Char](0x2423) };
'[\u007F]' { [Char](0x2421) };
default { $_ };
}
}
)
}
Function VisualizeControlCharacter(s As String)
For i = 0 To &H20
s = Replace(s, Chr(i), ChrW(&H2400 + i))
Next
s = Replace(s, Chr(&H7F), ChrW(&H2421))
VisualizeControlCharacter = s
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment