comp.lang.ada
 help / color / mirror / Atom feed
From: Victor Porton <porton@narod.ru>
Subject: Comparing version numbers
Date: Mon, 13 Nov 2017 04:39:11 +0200
Date: 2017-11-13T04:39:11+02:00	[thread overview]
Message-ID: <oub0kd$1a6r$1@gioia.aioe.org> (raw)

Not sure if it is quite on-topic, because it is more about general 
programming ideas rather than about Ada. (However, a solution in Python or 
Ruby or JavaScript would more likely used regexps than Ada.)

Suppose I have two version numbers of a software. I need to check which of 
the two is greater.

Lexical order string comparison does not work:

"2.3" vs "11.4".

I could split it by "." and compare the numbers. But a component of a 
version numbers may be nonnumeric like:

"1.2beta".

What to do?

It should work for example for all Debian packages containing interpreters 
(for example, "2.7" for "python" package).

-- 
Victor Porton - http://portonvictor.org


             reply	other threads:[~2017-11-13  2:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-13  2:39 Victor Porton [this message]
2017-11-13  5:15 ` Comparing version numbers J-P. Rosen
2017-11-13  8:04   ` briot.emmanuel
2017-11-13 11:11     ` Simon Wright
2017-11-13 21:30       ` briot.emmanuel
2017-11-13  8:10 ` Dmitry A. Kazakov
2017-11-13 15:56   ` Victor Porton
2017-11-13 17:22     ` Dmitry A. Kazakov
2017-11-13 18:54       ` Victor Porton
2017-11-13 20:25         ` Dmitry A. Kazakov
2017-11-16 15:33 ` Robert Eachus
2017-11-17 14:45 ` Shark8
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox