powershell - Relational operators on multiple decimal "numbers" -


i have need compare build numbers multiple decimal format, , wondering if there either powershell native or .net way this, rather rolling own. started simple -gt , strings, this

if ('12.3.0' -gt '12.2.3') {    $true } else {    $false } 

and works, long number of digits matches. falls apart.

if ('12.10.0' -gt '12.2.3') {    $true } else {    $false } 

to make matters worse, vendors autodesk use letters in build, um, numbers. builds n.44.0 , o.12.0 (that's capital o there in front). gets iffy. i'm sure roll own , split each build number on decimal , establish , cast correct type of each "digit" , compare then. that's fair amount of work if ps has built in solution haven't found yet.

version strings vary in format , content software publisher software publisher, , possibly product product. you'll have "roll own", , it'll end being different each vendor/product.

edited add: per @bill_stewart, [version] .net class can possibly simplify of issues involved. see msdn description.


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -