Skip to content

Instantly share code, notes, and snippets.

@brettmillerb
Created August 17, 2020 00:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brettmillerb/63efae0f1db5c8ccbdefa4519bf62a38 to your computer and use it in GitHub Desktop.
Save brettmillerb/63efae0f1db5c8ccbdefa4519bf62a38 to your computer and use it in GitHub Desktop.
CFP MBCrump
function Test-DivisibleByThree {
[CmdletBinding()]
[OutputType([String])]
Param (
[Parameter(Mandatory=$true,
ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true)]
$String
)
process {
if ((($_ -replace '[^0]').length % 3) -eq 0) {
'divisible by three'
}
else {
'not divisible'
}
}
}
Get-ChildItem -Path $file | % {
$_ | Test-DivisibleByThree
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment