Strip a set of characters from a string: Difference between revisions

Content added Content deleted
(added ruby)
Line 69: Line 69:
<lang perl>sub stripchars {
<lang perl>sub stripchars {
my ($s, $chars) = @_;
my ($s, $chars) = @_;
eval("\$s =~ tr/$chars//d");
eval("\$s =~ tr/$chars//d;");
return $s;
return $s;
}
}