dcoggie Posted April 28, 2017 Posted April 28, 2017 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)
argumentum Posted April 28, 2017 Posted April 28, 2017 (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 April 28, 2017 by argumentum fix the code Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
Subz Posted April 28, 2017 Posted April 28, 2017 Why not use _VersionCompare function? Example function:
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now