Re: version numbers
Re: version numbers
- Subject: Re: version numbers
- From: Chris Swain <email@hidden>
- Date: Tue, 22 May 2007 22:51:17 +0100
Brilliant!
Many Thanks
Chris
On 22 May 2007, at 21:36, Christopher Nebel wrote:
On May 21, 2007, at 11:14 AM, Chris Swain wrote:
I have an applescript studio application that requires particular
versions of a series of command-line programmes. I use do shell
script to find the version number (it is usually something like
2.14.10) and I need to check it is > 2.1.
I was going to break the version number down using the "." as a
delimiter and compare each part of the number, but I wondered if
anyone had something simpler?
If you can assume you're running on Tiger or later, you could use
"considering numeric strings", since that's exactly the problem it
was designed to solve. For example:
"2.14.10" > "2.2" --> false, as per standard dictionary ordering.
considering numeric strings
"2.14.10" > "2.2" --> true, if you consider each numeric string
to be a single "character".
end considering
--Chris Nebel
AppleScript Engineering
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden