Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Re: Sorting numeric strings

Thread Tools

Re: Sorting numeric strings

Arne Vajh°j
Posts: n/a
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.


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Sorting numeric strings Daniel Pitts Java 14 05-07-2012 06:42 PM
Re: Sorting numeric strings Roedy Green Java 0 05-01-2012 08:38 PM
Re: Sorting numeric strings Gene Wirchenko Java 0 05-01-2012 05:30 PM
check if string contains numeric, and check string length of numeric value C++ 5 06-30-2005 01:08 PM
DataGrid-DataView-XML-Sorting strings as numeric Joe Rattz ASP .Net Datagrid Control 2 11-20-2003 09:51 PM