Ruby - File IO
You want to read the entire content of a file and count how many times the word "ruby" appears, ignoring case. Which code correctly does this?
File.read('file.txt') to get full content as string./ruby/i in scan to find all case-insensitive matches, then count them.count which counts characters, not substrings.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions