[Gambas-user] analyzing version numbers in gambas

M0E.lnx m0e.lnx at ...626...
Thu Mar 26 18:07:13 CET 2009


I get this when I run this code
1.1
1.1
1.16
1.2
1.2
1.3
1.35
1.4
1.5
1.6

Notice how it's listing "1.1" and "1.2" twice, this is because of the entries "1.1" and "1.10" These would in fact need to be different 

I guess there really is no easy way other than splitting each version string into an array. For instance

DIM arg1, arg2 as string[]
dim s as string

arg1 = split("1.1", ".")
arg2 = split("1.16",".")

if val(arg1[0]) = val(arg2[0]) THEN ' same major version number
IF val(arg1[1]) > val(arg2[1]) then
	return val(arg1[1])
ELSE
	return val(arg2[1])
END IF

Maybe some extended version of something like that




More information about the User mailing list