Ok, I tried to delete lines that contain -- from a file. The file looks like this:
-----------------------------------------------------------------
Lorem ipsum....
Text.....
And my code:
f = File.open('C:\websites\ahr.txt')
f.each_line do |line|
if line.include? '-'
a = line
line.delete a
end
end
f = File.close
But it won't work! I get this error:
file.rb:5:in `delete': invalid range "-- (ArgumentError)
" in string transliteration
from file.rb:5:in `block in <main>'
from file.rb:2:in `each_line'
from file.rb:2:in `<main>'
What's going on?