# Version dependency calculator

## Recommended Posts

```; _IsVer1GEVer2                         Returns true if \$ver1 is greater than or equal to \$ver2.  Both versions are of the form a.b.c.d, where a,b,c&d are integers.
; @error =1 if \$ver1 is not stuctured properly
; @error =2 if \$ver2 is not stuctured properly
; @error =3 if the abcd components are not proper integers.
Func _IsVer1GEVer2(\$ver1,\$ver2)
Local \$arr1,\$arr2
Local \$n11,\$n12,\$n13,\$n14
Local \$n21,\$n22,\$n23,\$n24
Local \$ntot
;
\$arr1=StringSplit(\$ver1,'.')
If \$arr1 <> 5 Then
SetError(1)
Return False
EndIf
\$arr2=StringSplit(\$ver2,'.')
If \$arr2 <> 5 Then
SetError(2)
Return False
EndIf
;
\$ntot=IsInt(\$n11)+IsInt(\$n12)+IsInt(\$n13)+IsInt(\$n14)+IsInt(\$n21)+IsInt(\$n22)+IsInt(\$n23)+IsInt(\$n24)
If \$ntot<>8 Then
SetError(3)
Return False
EndIf
;
\$n11=\$arr1
\$n12=\$arr1
\$n13=\$arr1
\$n14=\$arr1
;
\$n21=\$arr2
\$n22=\$arr2
\$n23=\$arr2
\$n24=\$arr2
;
If \$n11>=\$n21 And \$n12>=\$n22 And \$n13>=\$n23 And \$n14>=\$n24 Then Return True
Return False
EndFunc; _IsVer1GEVer2```

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account

• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
×
• Create New...