From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: "J-P. Rosen" Newsgroups: comp.lang.ada Subject: Re: Comparing version numbers Date: Mon, 13 Nov 2017 06:15:49 +0100 Organization: Adalog Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Mon, 13 Nov 2017 05:15:45 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="52e308b729615beb6a9c02464f108f53"; logging-data="28507"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18UJyW7eeYTUA0kik1rsE3D" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 In-Reply-To: Content-Language: fr Cancel-Lock: sha1:/AER4laMBjDH7tqXz8NqGwRKo48= Xref: feeder.eternal-september.org comp.lang.ada:48843 Date: 2017-11-13T06:15:49+01:00 List-Id: Le 13/11/2017 à 03:39, Victor Porton a écrit : > 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". > Add '0's to the part before the '.' so that they have the same length: "02.3" vs "11.4". -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00 http://www.adalog.fr