[Gambas-user] analyzing version numbers in gambas

Rob sourceforge-raindog2 at ...94...
Wed Mar 25 16:59:56 CET 2009


On Wednesday 25 March 2009 11:29, Ron wrote:
> > I guess, in these cases, you can use the Val() function.
> Do a replace to remove the . then 12 is less(older) then 135.

That only works if all the versions are part of the same major release.  21 
is less than 135 too...

In Perl, I would do something like this:

($maj, $min) = split(/\./, $version);
$sortableversion = sprintf("%05d.%05d", $maj, $min);

I think you could do much the same in Gambas but it would take more lines, 
two Format() calls instead of just a sprintf, and you'd be using an array 
rather than two strings.

Rob




More information about the User mailing list