Board Logo

custom sorting function help
bidllc - 9/22/2005 at 09:17 PM

I have a column holding data in the format:

10 (33%)
12(36%)
5(3%)


I've written a function that strips the number in parens:

function sort(a)
{
var re = new RegExp("(.*)", "g");
return = Number(a.replace(re,""));
}

and referenced it properly. It works, except it appears to treat the value as a string sorting like this

1
2
30
4
55
6

Is there a way to get the result treated as a number??


Softcomplex: http://www.softcomplex.com/
Back to forum: http://www.softcomplex.com/forum/