Skip to Navigation | Skip to Content



Write your own isNumeric in any language! | December 20th, 2007

I found this interesting article today. I was looking for an isNumeric equivilent in ruby and discovered someone had cobbled together the equivilent in every language he could think of:

http://www.rosettacode.org/rosettacode/w/index.php?title=IsNumeric

Posted in rubyonrails | 3 Comments » | Add to Delicious | Digg It

This entry was posted on Thursday, December 20th, 2007 at 3:38 am and is filed under rubyonrails. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

3 Responses to “Write your own isNumeric in any language!”

  1. Alexei Says:

    By the way.. the best one for Ruby (if your value is a string) is:

    String.prototype.isNumeric = function() { return (this.match(/^d+$/) !=
    null); }

  2. Michael Mol Says:

    Actually, Rosetta Code is a wiki I founded almost a year ago. The IsNumeric page consists of contributions by almost two dozen individuals.

    Glad you found it interesting. Currently, though, a little less than half of the 121 tasks on the site have had Ruby solutions contributed.

  3. Alexei Says:

    That’s surprising. Hopefully more Ruby types will pick it up. Nice project, Michael.

Leave a Reply


Search Posts

You are currently browsing the archives for the Uncategorized category.

Archives

Categories

LinkedIn Profile

  • My Profile


My ideal work culture:
[See my summary] [What's yours?]