dcoggie

help to match 2 version numbers

4 posts in this topic

I'm comparing two strings containing programs (name and versions). The first string is read with a function from information on the computer. the second string is read from a list.
When the version numbers are not exactly the same it shows the program as out of date and this is incorrect.
Is there any way that I  can make it so that when (56.0.2924.87) = (56) it is not shown as out of date?
I want it to print --- Google chrome (56.0.2924.87)

Local $aApps = [[""Google Chrome", "56", 0], ["["Java.+?\d+ Update \d", "8.0.131.11", 3], ["Windows Live Essentials", "16.4.3528.0331", 0]]

Google Chrome (56.0.2924.87) is *out of date* ==> (56)
Java (8.0.1310.11) is *out of date* ==> (8.0.131.11)
Windows Live Essentials 16.4.3528.0331 is *out of date* ==> (16.4)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

4 minutes ago, dcoggie said:

Google Chrome (56.0.2924.87)

Func version2int($s)
    Local $r = "", $a = StringSplit($s,".")
    For $n = 1 To $a[0]
        $r &= StringRight("00000"&$a[$n],5)
    Next
    Return Int($r)
EndFunc

This should do it

Edited by argumentum
fix the code

Share this post


Link to post
Share on other sites

Why not use _VersionCompare function?  Example function:

 

Share this post


Link to post
Share on other sites

Thank you both. That helped.

Share this post


Link to post
Share on other sites

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

Sign in

Already have an account? Sign in here.


Sign In Now