件名ヘッダーが「|」で囲まれているドキュメントがあります。文字。
例: "| リンク |"
文字列の先頭と末尾が「|」かどうかを確認したい 特定のドキュメントのサブジェクト ヘッダーが有効であることを確認する文字。どうすればいいですか?
ソース:
@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
解析するドキュメント テキスト:
| LINKS |
http://www.extremeprogramming.org/ <1>
http://c2.com/cgi/wiki?ExtremeProgramming <2>
http://xprogramming.com/index.php <3>
| COMMENTS |
* Test comment
* Test comment 2
* Test comment 3