octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: comparing version numbers


From: Søren Hauberg
Subject: Re: comparing version numbers
Date: Fri, 24 Mar 2006 16:51:54 +0100

tor, 23 03 2006 kl. 23:34 +0100, skrev Soren Hauberg:
> tor, 23 03 2006 kl. 17:22 -0500, skrev John W. Eaton:
> > If there is a need to compare version numbers, then perhaps we should
> > have a function to do it that can handle things like 2.9.5+ or
> > 2.9.5+SVN-serial-number (or similar).
> There is a function for comparing version numbers in the package system I 
> sent you a while back. I don't think it supports anything else than numbers,
> but it might provide a starting base. (I don't have the source in front
> of me, so I can't say what should be changed)
Okay, so I found the source and modified it a bit to make the function a bit 
more general than what was needed in the package system. The attached function 
supports version strings such as 2.9.5-Whatever.

Two things should be noted:
  1) It acts like strcmp in C, i.e it returns -1 if the first version
string is "smaller" than the second, 0 if they are "equal", and 1
otherwise. I say "equal" (and "smaller") because 2.6 == 2.6.0
  2) The function doesn't work :-)
I need to be able to compare strings like I can in C using strcmp. Is
there an easy way to do this?

/Soren

Attachment: compare_version.m
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]