Data update

This commit is contained in:
Ingy döt Net 2026-02-01 16:33:20 -08:00
parent 5150844a7d
commit 4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions

View file

@ -1,79 +0,0 @@
function Select-NumberFromString
{
[CmdletBinding(DefaultParameterSetName="Decimal")]
[OutputType([PSCustomObject])]
Param
(
[Parameter(Mandatory=$true,
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true,
Position=0)]
[string]
$InputObject,
[Parameter(ParameterSetName="Decimal")]
[Alias("d","Dec")]
[switch]
$Decimal,
[Parameter(ParameterSetName="Hexadecimal")]
[Alias("h","Hex")]
[switch]
$Hexadecimal,
[Parameter(ParameterSetName="Octal")]
[Alias("o","Oct")]
[switch]
$Octal,
[Parameter(ParameterSetName="Binary")]
[Alias("b","Bin")]
[switch]
$Binary
)
Begin
{
switch ($PSCmdlet.ParameterSetName)
{
"Decimal" {$base = 10; $pattern = '[+-]?\b[0-9]+\b'; break}
"Hexadecimal" {$base = 16; $pattern = '\b[0-9A-F]+\b' ; break}
"Octal" {$base = 8; $pattern = '\b[0-7]+\b' ; break}
"Binary" {$base = 2; $pattern = '\b[01]+\b' ; break}
"Default" {$base = 10; $pattern = '[+-]?\b[0-9]+\b'; break}
}
}
Process
{
foreach ($object in $InputObject)
{
if ($object -match $pattern)
{
$string = $Matches[0]
}
else
{
$string = $null
}
try
{
$value = [Convert]::ToInt32($string, $base)
}
catch
{
$value = $null
}
[PSCustomObject]@{
Number = $value
String = $string
Base = $base
IsNumber = $value -is [int]
InputString = $object
}
}
}
}

View file

@ -1,7 +0,0 @@
$file = @'
John Doe abc1 K2hdystkrs
Jane Doe xyz2 Ew3jtdkufy
Joe Blow def3 Ouy1ttluyl
'@ -split [Environment]::NewLine
$file | Select-NumberFromString -Hexadecimal | Format-Table