Login Register






[Ruby] File Stats filter_list
Author
Message
[Ruby] File Stats #1
As mentioned in my previous thread, I made a number of things on my flight. The second is a pretty compact file statistics tool. Good for an Essay written in some off-brand text editor or some code you want in-depth stats for.

There's not much I can see myself adding so I don't think I'll be updating this much.

Anyway, enjoy!

Code:
#WordCount by Nightc||ed, ©2015 counta = 0 countb = 0 puts "Enter file name:" file = gets.chomp sspace = File.size("#{file}") File.foreach("#{file}") { |line| counta += line.scan(/[a-z0-9A-Z]+/).size countb += line.scan(/[a-z0-9A-z ]/).size } system "cls" puts "Stats for #{file}: •contains #{counta} words contains #{countb} standard characters is #{sspace} Bytes in size" sleep
It's often the outcasts, the iconoclasts ... those who have the least to lose because they
don't have much in the first place, who feel the new currents and ride them the farthest.

Reply