Quantcast
Channel: /r/powershell – How to Code .NET
Viewing all articles
Browse latest Browse all 8793

Function to convert ASCII to a string

$
0
0

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.


Viewing all articles
Browse latest Browse all 8793

Latest Images

Trending Articles



Latest Images