Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > convert big number to 1.6G, 24K, 2M etc format?

Reply
Thread Tools

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

 
 
Phlip
Guest
Posts: n/a
 
      06-21-2012
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/
 
Reply With Quote
 
 
 
 
Phlip
Guest
Posts: n/a
 
      06-22-2012
> 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?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GIDS 2009 .Net:: Save Big, Win Big, Learn Big: Act Before Dec 29 2008 Shaguf ASP .Net 0 12-26-2008 09:29 AM
GIDS 2009 .Net:: Save Big, Win Big, Learn Big: Act Before Dec 29 2008 Shaguf ASP .Net Web Controls 0 12-26-2008 06:11 AM
GIDS 2009 Java:: Save Big, Win Big, Learn Big: Act Before Dec 29 2008 Shaguf Python 0 12-24-2008 07:35 AM
GIDS 2009 Java:: Save Big, Win Big, Learn Big: Act Before Dec 29 2008 Shaguf Ruby 0 12-24-2008 05:07 AM
Re: PIL (etc etc etc) on OS X Kevin Walzer Python 4 08-13-2008 08:27 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57