I have a document with subject headings enclosed in "|" characters.
eg. "| LINKS |"
I want to check a line if it starts and ends with "|" to ensure that the specific title of the document object is valid. How to do it?
Source:
@filetarget = " < document file location here > "
@line = ""
file = File.new(@filetarget)
while (@line = file.gets)
if((@line.start_with?("|")) and (@line.end_with?("|")))
puts "Putting: " + @line
end
end
The text of the document to parse:
| LINKS |
http:
http:
http:
| COMMENTS |
* Test comment
* Test comment 2
* Test comment 3
source
share