> I have tried about a dozen different algorithms now, and I admit to being > stumped because everyone I've tried fails SOMEWHERE. > > The task before me is to compare version numbers of software packages and > determine which is higher. > First try was to simply do a string comparison. > This almost worked, except that > 4.0.12 > Is asciibeticallly smaller than > 4.0.1
String based: rework till you have a fixed pattern like 0004.0000.0012 Problem: the first 5 digit version nr (e.g. perl minor) breaks. If you take 5 digits, the first 6 digit will fail etc. number based: a version is a (small) array of integers. Better than string, but a string is variable length allowing in theory infinite subversions. So make it a dyn array to achieve the same. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal