比较两个小数点不超过4位的数字



我需要比较有多达4位小数点(14.7.3.13)的软件版本。我有一个静态列表,我比较电子表格中的值。如果电子表格中的值>=代码中的静态数字,则突出显示该单元格。我做这个有困难。我假设我的问题是数据类型。我已经将静态值声明为变量。我可以更改电子表格中的数据类型,但我不知道在电子表格的代码中使用什么数据类型

你能把软件版本拆分吗?字符,然后比较每个单独的"片段"的版本?像这样:

Dim value1() As String = version1.split(".")
Dim value2() As String = version2.split(".")
Dim greatestVersion As String
greatestVersion = value1 ' Start with greatest version as value1
If version1 = version2 Then ' Check to see if they are both the same
    greatestVersion = "BOTH THE SAME!"
Else If ' If not the same then determine the bigger value
For i=0 To value1.count
    If value2[i] > value1[i] Then
        greatestVersion = version2
    End If
Next


End If

最新更新