Skip to content

Instantly share code, notes, and snippets.

@torgro
Last active November 4, 2016 11:03
Show Gist options
  • Save torgro/4f6de0093b80e509e7e20091a21c48d3 to your computer and use it in GitHub Desktop.
Save torgro/4f6de0093b80e509e7e20091a21c48d3 to your computer and use it in GitHub Desktop.
function Test-String
{
param(
[parameter(Valuefrompipeline)]
[string]$InputObject
)
Begin
{}
Process
{
$bytes = [System.Text.Encoding]::ASCII.GetBytes("$InputObject")
$asciiValue = [System.Text.Encoding]::ASCII.GetString($bytes)
[pscustomobject]@{
InputString = $InputObject
ASCIIvalue = $asciiValue
IsEqual = $asciiValue -eq $InputObject
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment