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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
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
  readFile("wiki.txt")
  @info = info + "" + $myinfo
  len = @info.length(&:length)
  len2 = len - 1
  len3 = len2 - len1
  @words = len3.to_i
  file00=File.open("wiki.txt","r")
   info=""
   file00.each do |line|
      info=info + line
  end

   file00.close
   $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
   file1=File.open("wiki.txt","r")
   len2=file1.read.split.length
   @word=len2.to_s
This topic is locked and can not be replied to.