comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Comparing version numbers
Date: Mon, 13 Nov 2017 09:10:50 +0100
Date: 2017-11-13T09:10:50+01:00	[thread overview]
Message-ID: <oubk2a$7mb$1@gioia.aioe.org> (raw)
In-Reply-To: oub0kd$1a6r$1@gioia.aioe.org

On 13/11/2017 03:39, Victor Porton wrote:
> 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.)

I doubt regular expressions would help here, or any other kind of text 
patterns language. It is not a pattern matching problem.

> 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?

Is it what you are looking for:

    http://www.dmitry-kazakov.de/ada/strings_edit.htm#11

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

AFAIK, Debian's dh-make has somewhere an operation to compare versions 
the way apt does. I don't remember where. but it is there.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  parent reply	other threads:[~2017-11-13  8:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-13  2:39 Comparing version numbers Victor Porton
2017-11-13  5:15 ` 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 [this message]
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