Created
August 31, 2015 16:49
-
-
Save ooltcloud/c18a23e88e1b90bb06a1 to your computer and use it in GitHub Desktop.
制御文字を可視化する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function VisualizeControlCharacter($s) { | |
-join ( | |
$s.ToCharArray() | | |
% { | |
switch -regex ($_){ | |
'[\u0000-\u001F]' { [Char]([Int16]$_ + 0x2400) }; | |
'[\u0020]' { [Char](0x2423) }; | |
'[\u007F]' { [Char](0x2421) }; | |
default { $_ }; | |
} | |
} | |
) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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