EDIT 2: See this comment for a more elegant solution using .NET.
EDIT: Sorry, I wasn’t clear on what this actually does. It converts an array of character codes to ASCII text. Thanks u/ihaxr for pointing that out.
Because this was a source of some frustration to me today and I would like to save you all the trouble. Especially useful for converting values returned by System.DirectoryServices.
function Convert-ASCII {
param($ascii)
$letter = @()
foreach ($char in $ascii){
$char = [int[]]$char
$letter += [char[]]$char
}
$final = (“$letter”).Replace(” “,””)
Return $final
submitted by /u/billwrugbyling
[link] [comments]
The post Function to convert ASCII to a string appeared first on How to Code .NET.