w
Fix etlex ของ Lexitron ด้วย ruby
แบบว่าเอา concept มาจาก http://linux.thai.net/plone/Members/poonlap/dictd
แต่ไม่ได้ทำแบบรับค่า input ครับ
fixchar.rb:
fd1 = File.new("file_name",mode="r")
fd1.each_byte {|c|
    if c == 133
        c = "..."
    elsif c == 145 || c == 146
        c = "'"
    elsif c == 147 || c == 148
        c =  "\""
    elsif c == 149
        c = "-"
    elsif c == 150
        c = "--"
    elsif c == 151
        c = "---"
    elsif c == 252
        c = "----"
    elsif c == 160
        c = "-----";
    end
    putc c
}

เวลาใช้ก็ ruby fixchar.rb > new_file
Thursday 16 February 2006 - 19:26 PM