以下の内容はhttps://rochefort.hatenablog.com/entry/20120229/p1より取得しました。


Remove Characters

特別な文字を削除して表示。

設問

Write a program to remove specific characters from a string.

Input sample:

The first argument will be a text file containing an input string followed by a comma and then the characters that need to be scrubbed. e.g.

how are you, abc
hello world, def

Output sample:

Print to stdout, the scrubbed strings, one per line. Trim out any leading/trailing whitespaces if they occur.
e.g.

how re you
hllo worl

やってみた

#!/usr/bin/env ruby

ARGF.lines do |line|
  main, removes = line.split(',').map(&:strip)
  puts removes.chars.inject(main){ |str, char| str.gsub(char, '') }
end



以上の内容はhttps://rochefort.hatenablog.com/entry/20120229/p1より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14