convert big number to 1.6G, 24K, 2M etc format?

Discussion in 'Ruby' started by Phlip, Jun 22, 2012.

  1. Phlip

    Phlip Guest

    Given that "K G M" is deucedly hard to Google for, I'm gonna have to
    start writing this. (Yes it's probably easy...)

    While I do, have I overlooked something obvious? Raw Ruby, or Rails,
    or a snippet, thanks!

    --
    Phlip
    http://elaborateart.webcomics-x.com/2011/09/15/
     
    Phlip, Jun 22, 2012
    #1
    1. Advertising

  2. Phlip

    Phlip Guest

    > Given that "K G M" is deucedly hard to Google for, I'm gonna have to
    > start writing this. (Yes it's probably easy...)


    Oh duh it's action_view/helpers/number_helper.rb:
    number_to_human_size()

    Just search for KB GB MB.

    Darn it! I never get to write any original algorithms these days!!

    (Careful what we wish for, right?;)
     
    Phlip, Jun 22, 2012
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    805
    mlimber
    Sep 11, 2006
  2. Shaguf
    Replies:
    0
    Views:
    360
    Shaguf
    Dec 24, 2008
  3. Shaguf
    Replies:
    0
    Views:
    457
    Shaguf
    Dec 26, 2008
  4. Shaguf
    Replies:
    0
    Views:
    242
    Shaguf
    Dec 26, 2008
  5. Shaguf
    Replies:
    0
    Views:
    218
    Shaguf
    Dec 24, 2008
Loading...

Share This Page