[fpc-pascal] Comparing version numbers
vsnijders at quicknet.nl
Fri Jun 2 23:11:23 CEST 2006
A.J. Venter wrote:
> So the question is:
> 1) does somebody HAVE an algorithm for this already ?
> 2) If not, can somebody give me a hint about what approach to take ?
Split the version string in several numbers:
version := '4.0.12';
major := 4
minor := 0;
patch := 12;
versionnumber := major * 10000 + minor * 100 + patch
then you can numerically compare version numbers.
the 100 (a) and 10000 (b) can be adjusted for your needs.
a must be bigger than the max number of patches
b must be bigger that the max numer of patches times the max numer of
So this algorithm can not 4.194.299
More information about the fpc-pascal