Re: Sorting numeric strings

Discussion in 'Java' started by Arne Vajhøj, May 1, 2012.

  1. Arne Vajhøj

    Arne Vajhøj Guest

    On 4/30/2012 9:27 PM, Ben wrote:
    > Given the following data:
    >
    > Col1, Col2, Col3
    > 438.23, 991897664, ccc
    > 22.12, 991897631, bbb
    > 100.99, 881897631, aaa
    > 50.12, 991884803, ddd
    >
    > The class below will sort the data based on the column specified, except
    > Col1, which contains float values. If you set the SortCol variable below
    > to 0, sorting does not work. If you set it to 1 or 2, sorting does work.
    > How can I sort Col1 which is a column of numeric strings?


    I only works with Col2 because the strings has same length.

    If you need to sort after numerical value, then you need
    to convert values to numbers.

    Arne
     
    Arne Vajhøj, May 1, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    5
    Views:
    943
    X-Centric
    Jun 30, 2005
  2. Joe Rattz

    DataGrid-DataView-XML-Sorting strings as numeric

    Joe Rattz, Nov 19, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    219
    David Knipper
    Nov 20, 2003
  3. Gene Wirchenko

    Re: Sorting numeric strings

    Gene Wirchenko, May 1, 2012, in forum: Java
    Replies:
    0
    Views:
    391
    Gene Wirchenko
    May 1, 2012
  4. Daniel Pitts

    Re: Sorting numeric strings

    Daniel Pitts, May 1, 2012, in forum: Java
    Replies:
    14
    Views:
    844
    Gene Wirchenko
    May 7, 2012
  5. Roedy Green

    Re: Sorting numeric strings

    Roedy Green, May 1, 2012, in forum: Java
    Replies:
    0
    Views:
    437
    Roedy Green
    May 1, 2012
Loading...

Share This Page