< Back

Convert-MyNumber

Sat Jan 18, 2020 4:56 pm

NAME Convert-MyNumber



SYNOPSIS

Convert a numeric value.





SYNTAX

Convert-MyNumber [-Number] <Double> [-ToBinary] [<CommonParameters>]



Convert-MyNumber [-Number] <Double> [-ToHex] [<CommonParameters>]



Convert-MyNumber [-Number] <Double> [-ToOctal] [<CommonParameters>]





DESCRIPTION

Convert a numeric value to the specified format. The result will be a string.





PARAMETERS

-Number <Double>

A numeric value to be converted.



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByPropertyName, ByValue)

Accept wildcard characters? false



-ToBinary [<SwitchParameter>]

Convert the number to a binary string



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-ToHex [<SwitchParameter>]

Convert the number to a hex string



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-ToOctal [<SwitchParameter>]

Convert the number to an Octal string



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

System.Double







OUTPUTS

System.String







NOTES





Learn more about PowerShell: http://jdhitsolutions.com/blog/essentia ... resources/



-------------------------- Example 1 --------------------------



PS C:\\> convert-mynumber 123

1111011



The default behavior is to convert to binary.

-------------------------- Example 2 --------------------------



PS C:\\> 1024678 | convert-mynumber -ToHex

fa2a6





-------------------------- Example 3 --------------------------



PS C:\\> 1024678 | convert-mynumber -ToOctal

3721246







RELATED LINKS

New-MyNumber

Set-MyNumber