Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #14104

Re: Sorting numeric strings

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date Tue, 01 May 2012 17:02:07 -0500
Date Tue, 01 May 2012 15:02:09 -0700
From Patricia Shanahan <pats@acm.org>
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version 1.0
Newsgroups comp.lang.java.programmer
Subject Re: Sorting numeric strings
References <2012043021273098748-no@waycom> <CqVnr.242$go4.98@newsfe14.iad> <0km0q7lrv910pkbfb1lidbdfr3bkfjglui@4ax.com>
In-Reply-To <0km0q7lrv910pkbfb1lidbdfr3bkfjglui@4ax.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Message-ID <uKednQ89I8TCwD3SnZ2dnUVZ_sCdnZ2d@earthlink.com> (permalink)
Lines 18
X-Usenet-Provider http://www.giganews.com
NNTP-Posting-Host 70.230.201.141
X-Trace sv3-LKqrUcSi6WkSfwbZxNTX/rB4S0mJjwqXiWN3fOJOAcjpghDzZsik3bVrH/pci/+ro2OHbyfKPAZ3Qux!23IAFN6nWMdGdJ5Vhewvvv+9+a4GOUFBwRw0RVj1lPpLgK18Jljue5tAtZy7KmtK3V1ZNW/OC/pq!B3u2FRnXDHfTmcaalvagvDAwtAEe5QREBMiJRKYbg1y28BE=
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 1829
Xref csiph.com comp.lang.java.programmer:14104

Show key headers only | View raw


On 5/1/2012 2:50 PM, Roedy Green wrote:
> On Tue, 01 May 2012 10:53:35 -0700, Daniel Pitts
> <newsgroup.nospam@virtualinfinity.net>  wrote, quoted or indirectly
> quoted someone who said :
>
>>
>> In order to compare two strings as numbers, you need to pad zeros on
>> both extremes away from any "dot".
>
> the other way is with Double.parseDouble and compare the doubles.


Whether comparing doubles gives the correct result does depend on the
maximum number of significant digits. BigDecimal is always safe for
this, no matter how many significant digits.

Patricia

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Sorting numeric strings Ben <no@way.com> - 2012-04-30 21:27 -0400
  Re: Sorting numeric strings Arne Vajhøj <arne@vajhoej.dk> - 2012-04-30 21:39 -0400
  Re: Sorting numeric strings Gene Wirchenko <genew@ocis.net> - 2012-05-01 10:30 -0700
  Re: Sorting numeric strings Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-05-01 10:53 -0700
    Re: Sorting numeric strings Roedy Green <see_website@mindprod.com.invalid> - 2012-05-01 14:50 -0700
      Re: Sorting numeric strings Patricia Shanahan <pats@acm.org> - 2012-05-01 15:02 -0700
        Re: Sorting numeric strings Roedy Green <see_website@mindprod.com.invalid> - 2012-05-02 14:36 -0700
          Re: Sorting numeric strings Gene Wirchenko <genew@ocis.net> - 2012-05-02 19:57 -0700
          Re: Sorting numeric strings Dr J R Stockton <reply1218@merlyn.demon.co.uk.not.invalid> - 2012-05-03 19:41 +0100
            Re: Sorting numeric strings Roedy Green <see_website@mindprod.com.invalid> - 2012-05-03 17:40 -0700
              Re: Sorting numeric strings Lew <lewbloch@gmail.com> - 2012-05-03 18:11 -0700
                Re: Sorting numeric strings Martin Gregorie <martin@address-in-sig.invalid> - 2012-05-04 20:01 +0000
                Re: Sorting numeric strings Gene Wirchenko <genew@ocis.net> - 2012-05-04 14:19 -0700
                Re: Sorting numeric strings Martin Gregorie <martin@address-in-sig.invalid> - 2012-05-04 23:36 +0000
                Re: Sorting numeric strings Dr J R Stockton <reply1218@merlyn.demon.co.uk.not.invalid> - 2012-05-06 17:50 +0100
                Re: Sorting numeric strings Gene Wirchenko <genew@ocis.net> - 2012-05-07 10:34 -0700
                Re: Sorting numeric strings Joshua Cranmer <Pidgeot18@verizon.invalid> - 2012-05-07 12:38 -0500
                Re: Sorting numeric strings glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-05-07 17:48 +0000
                Re: Sorting numeric strings Gene Wirchenko <genew@ocis.net> - 2012-05-07 11:42 -0700
  Re: Sorting numeric strings Roedy Green <see_website@mindprod.com.invalid> - 2012-05-01 13:38 -0700

csiph-web