一个把紫光输入法的词库格式变为谷歌词库格式的ruby程序
outfile = File.new("out.txt","w")
File.open(gets.chomp) do |file|
file.each_line do |line|
a,b,c=line.chomp.split(/\t/)
outfile.write a+" "+c+" "+b+"\n"
end
end
outfile.close
outfile = File.new("out.txt","w")
File.open(gets.chomp) do |file|
file.each_line do |line|
a,b,c=line.chomp.split(/\t/)
outfile.write a+" "+c+" "+b+"\n"
end
end
outfile.close
评论功能维护中,当前仅展示历史评论。
为什么不直接 line.gsub("\t", ' ')