![]() |
Re: Sorting numeric strings
On Mon, 30 Apr 2012 21:27:30 -0400, Ben <no@way.com> 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? What do you mean by "sort"? What order will the first column's data be in when sorted? This is sorted by the first column by string value: 100.99, 881897631, aaa 22.12, 991897631, bbb 438.23, 991897664, ccc 50.12, 991884803, ddd I suspect that you want to sort by numeric value. In that case, you will have to convert to numeric values and sort the numeric values. But if, for example, leading or trailing zeroes affect the ordering, then you will have to define an order yourself. That will suggest how to proceed. [snip] Sincerely, Gene Wirchenko |
| All times are GMT. The time now is 04:13 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.