Forum: Ruby How can I make that code count characters only -- HELP

63f33bf06c2fa61f059ca295cb68c6f0?d=identicon&s=25 Miroslav Stoyanov (miroslav_s46)
on 2017-02-11 11:20
I want to make the first code count only letters, how can I do that?

#----------give the number of the characters
  len = info.length
  len1 = len
  @info = info + "" + $myinfo
  len = @info.length(&:length)
  len2 = len - 1
  len3 = len2 - len1
  @words = len3.to_i"wiki.txt","r")
   file00.each do |line|
      info=info + line

   $myinfo = info
   @info = $myinfo

   And this below should count only words, but it count ("."!"@"?";"
etc.. symbols too) symbols and space.
   #------------------------------gives the number of words 2 options"wiki.txt","r")
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.