Well, I'm using this one: Object.extend(String.prototype, { parseInt: parseInt.methodize(), parseFloat: parseFloat.methodize(), });
I thought this could be useful for someone else. > > I have been using methods for parseInt for a while. You simply call > 'string'.to_i(); > > // by encapsulating this code in an anonymous function, we can avoid > intrusion upon the global namespace > (function() { > var _ruby_methods = { > to_i: function() { // helper function for parseInt > return parseInt(_string, 10); > } > }; > > Object.extend(String.prototype, _ruby_methods); > Object.extend(Number.prototype, _ruby_methods); > })(); > > On Jan 28, 2:37�pm, "artemy tregoubenko" <[EMAIL PROTECTED]> > wrote: >> Hello! >> >> What do you think about making parseInt & parseFloat string methods too? >> >> -- >> arty (http://arty.name) > > -- arty ( http://arty.name ) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---