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, Jun 22, 2012
    #1
    1. Advertisements

  2. Phlip

    Phlip Guest

    Given that "K G M" is deucedly hard to Google for, I'm gonna have to
    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. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.