Based on Mislavs function here's on that also handles special cases
like _rc1.
function vnum(vstring) {
var v = vstring.replace(/_.*|\./g, '');
v = parseInt(v + '0'.times(4-v.length));
return vstring.indexOf('_') > -1 ? v-1 : v;
}
vnum('1.6.0') > vnum('1.6.0_rc1') //-> true
vnum('1.6.0') //-> 1600
vnum('1.6.0.2') //-> 1602
vnum('1.6.0_rc1') //-> 1599
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---